用JQuery  
   $("input").focus(function(){
              this.value="";  // or 
              $(this).val(""); //这两样都不管用,问题出在哪了?
              });
 我的本意很简单,输入框获得焦点的时候里面的说明文字被清除

解决方案 »

  1.   


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title> New Document </title>
    <style type="text/css">

    </style>
    <script src="jquery-1.5.min.js"></script>
    <script type="text/javascript">
    $(function() {
    $("input").focus(function(){
                  //this.value="";  // or 
                  $(this).val(""); //这两样都不管用,问题出在哪了?
                  });
    });
    </script>
    </head>
    <body>
    <input type="text" value="test" />
    </body>
    </html>我测试两个都没问题 你是不是没有写到 $(document).ready(function(){})中
      

  2.   

    可能是没导入jquery或没写到onload中
      

  3.   

    的确是没有 $(document).ready(function(){}) 就不成