You can put your code through jslint. JSLint,The JavaScript Code Quality Tool
Just copy and paste into the text box and hit the JSLint button
On the first go it comes up with this
Code:
Error:
Problem at line 1 character 19: Expected ';' and instead saw 'var2'.
var1="pic1.gif"
Problem at line 3 character 19: Expected ';' and instead saw 'now'.
var3="pic3.gif"
Problem at line 4 character 18: Expected ';' and instead saw 'num'.
now=new Date()
Problem at line 5 character 29: Expected ';' and instead saw 'num'.
num=(now.getSeconds() )%3
Problem at line 6 character 13: Expected ';' and instead saw 'quot'.
num=num+1
Problem at line 7 character 12: Expected ';' and instead saw 'double'.
quot="'" //this is double quote, single quote,
Problem at line 8 character 4: Expected an assignment or function call and instead saw an expression.
double quote which produces '
Problem at line 8 character 10: Expected ';' and instead saw 'quote'.
double quote which produces '
Problem at line 8 character 11: Expected an assignment or function call and instead saw an expression.
double quote which produces '
Problem at line 8 character 16: Expected ';' and instead saw 'which'.
double quote which produces '
Problem at line 8 character 17: Expected an assignment or function call and instead saw an expression.
double quote which produces '
Problem at line 8 character 22: Expected ';' and instead saw 'produces'.
double quote which produces '
Problem at line 8 character 32: Unclosed string.
double quote which produces '
Problem at line 8 character 32: Stopping. (47% scanned).
Implied global: var1 1, var2 2, var3 3, now 4,5, num 5,6, quot 7, double 8, quote 8, which 8
You could certainly do with adding in semicolons at the end of lines. It also chokes on your comment, as Paul pointed out.
RLM
Bookmarks