user2234760
user2234760

Reputation: 143

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

registerForm()

in the onclick event on line 15 and gives the error "Object Expected".

<!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>

Upvotes: 2

Views: 14660

Answers (1)

Sudhir Bastakoti
Sudhir Bastakoti

Reputation: 100175

change

<script type="text/javscript">

to

<script type="text/javascript"> //you missed "a" in script tag

Upvotes: 1

Related Questions