![]() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
![]() |

|
| Knowledge Base Most common error and how to trouble shoot them off |
![]() |
|
Get element ID from a clicked checkbox into numeric variable
|
LinkBack | Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Fixed Error!
Posts: 141
Location: Chennai
Join Date: Feb 2007
Rep Power: 2
IM:
|
I have a form with 200 plus checkboxes. When the checkbox is checked onClick passes (this) to a Javascript function. I need to get the element array ID of the just checked checkbox into a numeric variable. The following routine never finds a match. The value returned in thisCheckID is blank when I send it to a text field. function getcheckboxid(formobj) { var checkboxname=formobj.name; var checks = document.getElementsByTagName("INPUT"); var len = checks.length; var thisCheck, thisCheckID; for (var i = 0; i < len; i++) { if (checks[i].name == checkboxname) { thisCheckID = checks[i].id; } document.form1.text1.value=thisCheckID; } |
|
|
|
|
|
|
|
|
#2 (permalink) |
|
Fixed Error!
Posts: 141
Location: Chennai
Join Date: Feb 2007
Rep Power: 2
IM:
|
200+ checkboxes is huge. I haven't done a project that many of checkboxes yet. anyway, if you need anything more do let me know. otherwise, don't forget to accept my answer. |
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|