Javascript Errors <- Please !

java , vb6 United States
  • 17 years ago

    could someone wirte me a piece of javascript or html or something that causes an error - like invalid object, or object not defined


    so that i can test my webbrowser to see how it handles scripts with errors


    ta

  • 17 years ago

    heres some code , it errors cos i knocked the d of document 6 lines from the bottom


    Code:

    <html>
    <body>
    <script language="JavaScript">
    <!--




    var message="You are not aloud to access the code, sorry";
    var messagerule="I am sending you to my copyright page which will give you the summary of the codes";
    function click(e) {
    if (document.all) {
    if (event.button==2||event.button==3) {
    alert(message)
    alert(messagerule)
    window.open("law.htm")
    return false;
    }
    }
    if (document.layers) {
    if (e.which == 3) {
    alert(message);
    return false;
    }
    }
    }
    if (document.layers) {
    document.captureEvents(Event.MOUSEDOWN);
    }
    ocument.onmousedown=click;
    // -->
    </script>


    </body>
    </html>



    this brings the warning box up, but this all depends on the settings for ie (im presumming ure using the webbrbowser control) message "ocument is not defined"

  • 17 years ago

    Excellent


    thank you.

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Some people, when confronted with a problem, think "I know, I’ll use regular expressions." Now they have two problems.” - Jamie Zawinski