I have an application in which clicking on a checkbox should make rest of the checkboxes checked. its rather simple. I have never used Javascript before so i have no clue how to get through this.
here's my code.
this is the checkbox which on checked should make other check boxes checked.
Expand|Select|Wrap|Line Numbers
- <td >
- input <%If (Session("stateid") <> "") Then Response.Write("checked=""checked""") : Response.Write("")%> name="stateid" type="checkbox" class="body" id="stateid" onclick="javascript:checkall(stateID);" value="checkbox" />
- All States.
- </td>
Expand|Select|Wrap|Line Numbers
- <td
- <input <%For x = 0 to Ubound(Session("preferenceID"),1)%><%If (cInt(Session("preferenceID")(x)) = cInt((StateDDL.Fields.Item("stateID").Value))) Then Response.Write("checked=""checked""") : Response.Write("")%><%Next%> name="stateID" type="checkbox" id="stateID" value="<%=(StateDDL.Fields.Item("stateID").Value)%>" />
- <%=(StateDDL.Fields.Item("stateName").Value)%> </td>
and here's my javascript(i'm not sure how perfect this is)
Expand|Select|Wrap|Line Numbers
- <script type="text/JavaScript">
- function checkall(stateID)
- {
- stateID.Checked=true;
- }
- </script>
Ayush