Javascript question

Ian Stephen ianstepn
Mon May 17 11:55:29 PDT 2004


On Sun, 2003-11-09 at 18:36, joel wrote:

> this function doesn't work:
> function ClearForm(form){
> for (i=0; i < form.length ; i++) {
>  form[i].checked = false
>  if (form[i].value.search(/^MARGINS *\$1U? *$/) > -1){form[i].checked=true}
>  par[i] = "" }
>  form[1].checked = true
> }

To get the function to do anything I had to change
onClick="ClearForm(form1)" to onClick="ClearForm(this.form)"

Inserting alert()s into your function to follow its operation it seemed
to work up to and including an 'else {alert("else")}' below your 'if'
line.  After that the alert()s don't run.

Also an alert() inserted to run if the 'if' is true didn't go, but I'm
sorry to admit that I don't know diddly about regular expressions so
don't know if my form entries met the criteria to make the 'if' true. 
Used reg. exp. for the first time a couple of days ago to edit a huge
file in emacs.  Definitely gotta learn more of that!

an alert() outside your for loop never goes, so it seems the for loop
doesn't exit?  Google couldn't find me anything about that 'par[i] = ""'
line.  What's a "par"

Oh, and disregard previous post about "var".  Makes no difference it
seems.

IanS



More information about the Linux-users mailing list