日期:2014-05-16  浏览次数:20299 次

初学javascript 基础问题
<!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>
<script   language= "javascript1.3 ">

function   method()
{
alert( "失去焦点 ");
}
</script>
<meta   http-equiv= "Content-Type "   content= "text/html;   charset=gb2312 "   />
<title> 无标题文档 </title>

</head>

<body>
<form   id= "form1 "   name= "form1 "   method= "post "   action= " ">
    <p   align= "center ">
        <input   name= "textfield "   type= "text "     onBlur= "method() "   value= "这里请输入你的名字 "   />
    </p>
</form>

</body>
</html>


为什么失去焦点的事件不会发生呢?   反而提示有错误   谢谢!

------解决方案--------------------
method是关键字
------解决方案--------------------
method()
起个有意思的名字不错,但你着过分了~
------解决方案--------------------
function method()
改成其他名字 比如function method1()
关键字你也敢用 真是的

------解决方案--------------------
或者改成 onblur= "window.method() "