<html>
<head>
</head>
<script type="javascript">
function dante()
{
alert("测试");
}
</script>
<body>
<input id="search" name="search" onkeypress = "dante()"/>

</body>
</html>提示缺少对象

解决方案 »

  1.   


    <html>
    <head>
    </head>
    <script language="javascript">  //这里的错
        function dante()
        {
            alert("测试");
        }
    </script>
    <body>
        <input id="search" name="search" onkeypress = "dante()" />
        
    </body>
    </html>
      

  2.   

    用type的话要这样<html>
    <head>
    </head>
    <script type="text/javascript">
        function dante()
        {
            alert("测试");
        }
    </script>
    <body>
        <input id="search" name="search" onkeypress = "dante()" />
        
    </body>
    </html>
      

  3.   

    正常,呵呵,我刚写JS的时候还经常private int a =...
      

  4.   

    <html>
    <head>
    </head>
    <script type="text/javascript">
        function dante()
        {
            alert("测试");
        }
    </script>
    <body>
        <input id="search" name="search" onkeypress = "dante()"/>
        
    </body>
    </html>