Getting "object expected" error when trying to call a function in javascript

14,403

change

<script type="text/javscript">

to

<script type="text/javascript"> //you missed "a" in script tag
Share:
14,403
user2234760
Author by

user2234760

Updated on June 13, 2022

Comments

  • user2234760
    user2234760 almost 2 years

    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>