[Solved] Javascript – novice script not working
if(x==0) Since x doesn’t exist, it throws a ReferenceError here and aborts the rest of the function. You need to declare x first. This: function Xyz() { var x=0; } Creates a variable x that is local to the function and Is never called anyway solved Javascript – novice script not working