View Full Version : runtime error 'undefined' is null or not an object
chucktcl
08-10-2002, 07:08 AM
Hi,
Does anyone know why this javascript will not work? I have tried to debug it but haven't been able to see why an error is being generated at line 87 'undefined' is null or not an object.
Thanks,
Chuck
kansel
08-10-2002, 12:03 PM
I'm getting an undefined on line 57 (based on your txt file) and that is because emailCheck(emailStr) is expecting an argument but an argument is not being passed to it in submitForms()
You'll either need to pass the email (document.addform.Email.value) when you call the emailCheck() in submitForms(), or you'll need to set emailStr to document.addform.Email.value inside the emailCheck() function.
Squintz
08-10-2002, 12:56 PM
I'm new so i won't be of much help but this is relating to your code...
Iv read a few tutorials and have a good understandings of the basics of JS...But what i cant figure out is when and when not to place the " ; " Simi colon...I notice you wrote in your script a few time return true and then other times you wrote return true;....
Can someone do a quick run down of when and when not to use the semi colon...It was my understanding to use it at the end of each line or statement
kansel
08-10-2002, 06:46 PM
Squintz -
JavaScript is a very 'loose' language in that things like semicolons (;) are not always required.
Some places semicolons are required
- when executing more than one command on a single line
- inside a for() control loop
- any time commands must be separated but cannot be on separate lines
It is possible to write functional javascript with no semicolons (using something other than for() loops). It is just as possible to write a functional javascript with no line breaks, separating each command with a semicolon - view the source on this page http://webfx.eae.net/games/minehunter/minehunter.html for an example.
I personally find that scripts with all the semicolons are easier to debug and maintain. You are of course free to code however you wish, but if you're serious about JavaScript you'll want to make your code as easy to read as possible. You'll be glad you did when you revisit that thousand-line script in a month or two.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.