Hello everyone !
I am a novice in ASP and HTML realm and need some serious help. I am trying to develop a ASP document that would pull some data from a Database (In Access 2000) and then display them on a table. Now that much I have fiqures ... no problem there. My tabel is of three colums. The first colum is a CheckBox, the second and third is the data from the DB. The heading for the CheckBox colum also has a Checkbox. What I want to do is select all the checkboxes (Meaning CHKECH THEM ALL) when the checkbox in the heading is checked. So I want to do somthing like a basic Hotmail Inbox thing when the top checkbox is pressed all the checkboxes in the table are checked also. Now here is what I have so far
<%
'This is the heading
<TR><TD> <input type=checkbox name=ALL value= onClick=SetChecked(4);> </TD> <TH width=738> <font size=2> <u>Message</u></font> </TH> <TH width=120> <font size=2 > <u>Date</u></font> </TH> </TR>"
'Filling the Table with Data
Do While NOT rsdata.EOF
'i is just to see how many rows I get. Here RSDATA is my recordset in the database
i = i + 1
Response.Write "<TR><TD><input type=checkbox name=m" & i & " </TD>" & "<TD >" & rsdata("Message" & "</TD>" & "<TD align=center>" & rsdata("Date" & "</TD>" & "</TR>"
rsdata.MoveNext
Loop
%>
Now here is the Function that I wrote for the ONCLICK event for the Checkbox in the Heading
<script language="JavaScript">
<!--
function SetChecked(val)
{
dml= document.MainTable;
len = 4;
for( i=1 ; i<len ; i++)
{
//Here is the problem.... How do I refer to my Chekcboxes
// This will work m1.checked= true; or m2.checked= true;
// But I want to be able to go through the loop and turn them on.
// I think I am just goofing off on the syntax.
mi.checked= true;
}
}
// -->
</SCRIPT>
//////////////////
Check out my comments with the Function to see what i mean .. I need help bacially on the syntax in Jscript Can any one help please !!!!
Thanks
Adil
I am a novice in ASP and HTML realm and need some serious help. I am trying to develop a ASP document that would pull some data from a Database (In Access 2000) and then display them on a table. Now that much I have fiqures ... no problem there. My tabel is of three colums. The first colum is a CheckBox, the second and third is the data from the DB. The heading for the CheckBox colum also has a Checkbox. What I want to do is select all the checkboxes (Meaning CHKECH THEM ALL) when the checkbox in the heading is checked. So I want to do somthing like a basic Hotmail Inbox thing when the top checkbox is pressed all the checkboxes in the table are checked also. Now here is what I have so far
<%
'This is the heading
<TR><TD> <input type=checkbox name=ALL value= onClick=SetChecked(4);> </TD> <TH width=738> <font size=2> <u>Message</u></font> </TH> <TH width=120> <font size=2 > <u>Date</u></font> </TH> </TR>"
'Filling the Table with Data
Do While NOT rsdata.EOF
'i is just to see how many rows I get. Here RSDATA is my recordset in the database
i = i + 1
Response.Write "<TR><TD><input type=checkbox name=m" & i & " </TD>" & "<TD >" & rsdata("Message" & "</TD>" & "<TD align=center>" & rsdata("Date" & "</TD>" & "</TR>"
rsdata.MoveNext
Loop
%>
Now here is the Function that I wrote for the ONCLICK event for the Checkbox in the Heading
<script language="JavaScript">
<!--
function SetChecked(val)
{
dml= document.MainTable;
len = 4;
for( i=1 ; i<len ; i++)
{
//Here is the problem.... How do I refer to my Chekcboxes
// This will work m1.checked= true; or m2.checked= true;
// But I want to be able to go through the loop and turn them on.
// I think I am just goofing off on the syntax.
mi.checked= true;
}
}
// -->
</SCRIPT>
//////////////////
Check out my comments with the Function to see what i mean .. I need help bacially on the syntax in Jscript Can any one help please !!!!
Thanks
Adil