读书人

模拟淘宝搜寻框

发布时间: 2012-09-03 09:48:39 作者: rapoo

模拟淘宝搜索框

<html>    <head>        <title>         测试输入框        </title>        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.min.js"></script>        <script type="text/javascript">   $(function(){           $("#q").focus(function() {    $("label[for=q]").hide();           });           $("#q").blur(function () {   //  alert($("#q").val());          if ("" == $("#q").val()) {          $("label[for=q]").show();          }          }); });        </script>    </head>        <body>        <form>            <span>模拟搜索框:                 <label for="q" style="visibility: visible; color: #666; position: absolute; left: 120px; top: 18px; ">输入您想搜索的宝贝</label>                 <input id="q" type="text" autocomplete="off" title="搜索宝贝" name="q" size="25" />            </span>        </form>    </body></html>

?

读书人网 >Web前端

热点推荐