tick the boxes

W

WindAndWaves

Hi Gurus

I am sorry to ask so many questions, but unfortunately, you are just such an
awesome source of knowledge that I can not help myself but ask lots. One
day, I hope to be able to answer other people's questions.

Here we go, I have the following function (I made it myself ...!)

function tic(form,a,z){
for(f=a;z;f++){
if(form[f].type=="checkbox"){
form[f].checked=true;
}
}
}

It is supposed to tick a range of tickboxes (e.g. 1-10 or 11-30), I want to
use a and z to identify the range.

I use the following to call the function:

<LABEL FOR="0">
<INPUT TYPE="checkbox" VALUE="0" NAME="0" CLASS="ix"
ONCLICK="tic(this.form,0,1);">
New Zealand Wide</LABEL>

However, even with a range from 0 to 1, it will tick all the boxes in the
form. Secondly, does anyone know how to make the reverse function? Can I
add a fourth variable that indicates whether the current tickbox is true or
false and then use this in the function?

I hope it all makes sense

Thank you once more for all your help

- Nicolaas
 
M

Mark Parnell

Previously in alt.html said:

Gurus is on holidays, and isn't due back until after Christmas. Sorry.
;-)

The following is JavaScript, and as such is best addressed in a
JavaScript newsgroup, such as news://comp.lang.javascript

That's not to say that no one in alt.html can answer it, but in general
it is best to ask in a group specifically aimed at JavaScript.
Cross-posted and followups set.
Here we go, I have the following function (I made it myself ...!)

function tic(form,a,z){
for(f=a;z;f++){
if(form[f].type=="checkbox"){
form[f].checked=true;
}
}
}

It is supposed to tick a range of tickboxes (e.g. 1-10 or 11-30), I want to
use a and z to identify the range.

I use the following to call the function:

<LABEL FOR="0">
<INPUT TYPE="checkbox" VALUE="0" NAME="0" CLASS="ix"
ONCLICK="tic(this.form,0,1);">
New Zealand Wide</LABEL>

However, even with a range from 0 to 1, it will tick all the boxes in the
form. Secondly, does anyone know how to make the reverse function? Can I
add a fourth variable that indicates whether the current tickbox is true or
false and then use this in the function?

I hope it all makes sense

Thank you once more for all your help

- Nicolaas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,042
Latest member
icassiem

Latest Threads

Top