Forum Moderators: open

Message Too Old, No Replies

general Javascript troubleshooting strategy

troubleshoot javascript invalid argument general strategy

         

Volterra

8:29 am on Apr 16, 2004 (gmt 0)

10+ Year Member



Hi,

Do you know of a resource which illustrates a step by step guide to troubleshooting Javascript errors?

I am receiving an Invalid Argument error for a line number and char number that doesn't exist.

My scan of the code cannot see any obvious errors.

Cheers

Alternative Future

8:59 am on Apr 16, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld Volterra,

You can place alert(); statements before the line outputting parameters/variables and values to see where the error might be.

An example:

<script>
function testAlert(myParameter){
alert("myParameter = "+myParameter);
//then do other stuff relating to the function
}
</script>

<body>
<a id="myAnchorTag" href="javascript:myAlert(this.id)">Test alert</a>
</body>

Its a case of debugging your current javascript and finding where the error might exist.
Is your function inline with the HTML or external to the HTML? As this can cause a problem with looking for line numbers affected!

HTH,

-George

RonPK

12:03 pm on Apr 16, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello Volterra,
The Mozilla and Opera browsers both give much more detailed error messages than MSIE. One more reason to switch!

Rambo Tribble

1:21 pm on Apr 16, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Mozilla also incorporates the Venkman JavaScript Debugger. It can help you identify those elusive runtime errors.