DIV CSS 佈局教程網

 DIV+CSS佈局教程網 >> 網頁腳本 >> CSS入門知識 >> CSS詳解 >> css漂亮的輸入框:CSS美化的漂亮搜索框
css漂亮的輸入框:CSS美化的漂亮搜索框
編輯:CSS詳解     
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xHtml1-transitional.dtd">
  2. <Html XMLns="http://www.w3.org/1999/xHtml">
  3. <head>
  4. <title>CSS美化的漂亮搜索框 - www.cxybl.com</title>
  5. <meta http-equiv="content-type" content="text/Html;charset=gb2312">
  6. <style type="text/CSS">
  7. <!--
  8. .search{
  9. padding-right:10px;
  10. padding-left:10px;
  11. padding-top:5px;
  12. padding-bottom:5px;
  13. width: 280px;
  14. background:#1A93CC;
  15. float:left;
  16. position:relative;
  17. }
  18. .search .input{
  19. padding-top:2px;
  20. height:16px;
  21. width: 180px;
  22. border: 1px solid #0086C6;
  23. font-size:14px;
  24. background:#fff url(search_btn.gif) no-repeat right 0;
  25. }
  26. .label{
  27. color:#ccc;
  28. position:absolute;
  29. left:12px;top:6px;
  30. display:block;
  31. height:22px;
  32. line-height:22px;
  33. font-size:12px;
  34. }
  35. span.submit{
  36. cursor:pointer;
  37. position:absolute;
  38. left:171px;
  39. top:6px;
  40. width:20px;
  41. height:20px;
  42. text-indent:-999em;
  43. }
  44. -->
  45. </style>
  46. </head>
  47. <body>
  48. <div class="search">
  49. <form action="" method="post" name="search" id="search">
  50. <input name="keyWord" type="text" class="input" id="keyWord" value="" style="float:left;">
  51. <label for="keyWord" id="for-keyWord" class="label">我要搜索</label>
  52. <span class="submit" onclick="return formSubmit('frmsearch');">搜索</span>
  53. </form>
  54. </div>
  55. <script type="text/Javascript">
  56. var $ = function(id){return document.getElementById(id);}
  57. var formSubmit = function(id){
  58. document.forms[id].submit();
  59. return false;
  60. }
  61. var tip = function(q, for_q){
  62. q = $(q);
  63. for_q = $(for_q);
  64. q.onfocus = function(){
  65. for_q.style.display = 'none';
  66. q.style.backgroundPosition = "right -17px";
  67. }
  68. q.onblur = function(){
  69. if(!this.value) for_q.style.display = 'block';
  70. q.style.backgroundPosition = "right 0";
  71. }
  72. for_q.onclick = function(){
  73. this.style.display = 'none';
  74. q.focus();
  75. }
  76. };
  77. tip('keyword','for-keyWord');
  78. </script>
  79. </body>
  80. </Html>
本文鏈接http://www.cxybl.com/html/wyzz/CSS/20130908/40079.Html
XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved