Forums
This topic is locked
Select all checkbox
Posted 11 Jun 2001 00:12:42
1
has voted
11 Jun 2001 00:12:42 gianluca jean posted:
I have a javascript that select and deselect all checkbox of recordset, itwork if the recordset doesn't include between form tag, Any ideas?
thanks to all
<% cont=0
While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF))
%>
<input type=checkbox name=checkbox
value="<%=(Recordset1.Fields.Item("Id".Value)%>">
<% cont=cont+1
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
Recordset1.MoveNext()
Wend
%>
</td>
</tr>
</table>
<script language=javascript>
function tagselezione() {
for (i=0; i<totalecheckbox.value; i++) {
checkbox(i).checked = selezall.checked;
}
}
</script>
</form>
<input type=hidden name="totalecheckbox" value=<%=cont%>>
Replies
Replied 02 Jan 2002 19:53:13
02 Jan 2002 19:53:13 Tolu Ayoola replied:
what exactly do you want for the script to do? I got something similar to that on mine but its main goal was to add email addresses to a list when checked or remove when unchecked.
here's the main script
function checkall() {
if (!document.mail.checkall || !document.mail.checkall2) {
return
}
var t = document.mail.elements.length
var c = 0
if (document.mail.checkall.checked || document.mail.checkall2.checked)
c = 1
if (!document.mail.checkall.checked || !document.mail.checkall2.checked)
clr();
for (var i = 0; i < t; i++) {
if (document.mail.elements[i].name == "usr" {
document.mail.elements[i].checked = c
}
}
sumall();
}
make sure u use this
if (document.mail.elements[i].name == "usr"
to seperate other check boxes from the ones in the form tag
did that help? <img src=../images/dmxzone/forum/icon_smile_approve.gif border=0 align=middle>
The initial thought of failure is the begining of failure itself -Tolu Ayoola
here's the main script
function checkall() {
if (!document.mail.checkall || !document.mail.checkall2) {
return
}
var t = document.mail.elements.length
var c = 0
if (document.mail.checkall.checked || document.mail.checkall2.checked)
c = 1
if (!document.mail.checkall.checked || !document.mail.checkall2.checked)
clr();
for (var i = 0; i < t; i++) {
if (document.mail.elements[i].name == "usr" {
document.mail.elements[i].checked = c
}
}
sumall();
}
make sure u use this
if (document.mail.elements[i].name == "usr"
to seperate other check boxes from the ones in the form tag
did that help? <img src=../images/dmxzone/forum/icon_smile_approve.gif border=0 align=middle>
The initial thought of failure is the begining of failure itself -Tolu Ayoola