[英]Getting “object expected” error when trying to call a function in javascript
The window.alert function does not work and the debugger in internet explorer highlights window.alert函数不起作用,Internet Explorer中的调试器突出显示
registerForm()
in the onclick event on line 15 and gives the error "Object Expected". 在第15行的onclick事件中,给出错误“期望的对象”。
<!DOCTYPE html>
<head>
<title></title>
<meta charset="utf-8" />
<script type="text/javscript">
/* <![CDATA[ */
function registerForm() {
window.alert("Function is working");
}
/* ]]> */
</script>
</head>
<body>
<form action="" method="get" enctype="application/x-www-form-urlencoded">
<p><input type="button" value="Register" onclick="registerForm();" /></p>
</form>
</body>
</html>
</body>
change 更改
<script type="text/javscript">
to 至
<script type="text/javascript"> //you missed "a" in script tag
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.