Advertisement

12.21.2006 at 03:02PM PST, ID: 22101148
[x]
Attachment Details

Get element ID from a clicked checkbox into numeric variable

Asked by GerryLavender in JavaScript, Extensible HTML (XHTML)

Tags: get, javascript, id, element

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;
      }Start Free Trial
[+][-]12.21.2006 at 03:24PM PST, ID: 18184228

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]12.21.2006 at 03:51PM PST, ID: 18184356

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]12.21.2006 at 04:40PM PST, ID: 18184544

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]12.22.2006 at 12:08AM PST, ID: 18185790

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]12.22.2006 at 01:38AM PST, ID: 18186038

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]12.22.2006 at 04:51AM PST, ID: 18186550

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]12.22.2006 at 08:40AM PST, ID: 18187995

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]12.22.2006 at 10:34AM PST, ID: 18188691

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: JavaScript, Extensible HTML (XHTML)
Tags: get, javascript, id, element
Sign Up Now!
Solution Provided By: third
Participating Experts: 5
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32