[thelist] JavaScript Question

Ornstein, Ian IanOrnstein at NC.SLR.com
Mon Oct 29 16:12:39 CST 2001

thanks for you reply, Jeff.

I want to access the radio buttons on the form by form name
so I don't cause a maintenance problem resulting from the 
movement of forms on the page.

He is the code I was writing:
function ChooseColor(strColor)
var strColorOption;
var el;
var i;
   for ( i=0;i<3;i++) 
        if (document.forms[0].sColor[i].checked) 
            strColorOption  = document.forms[0].sColor[i].value;
    el =  document.getElementById("bip");
    switch (strColorOption)
        case "Background" :
            el.style.backgroundColor = strColor;                 
        case "Font"       :
            el.style.color = strColor;                 
        case "Border"     :
            el.style.borderColor = strColor;                 

Although it works with "forms[0]", 
I would like to understand why it is not working with the form name
like my other code.  Do you have some dynamic debugging
tools that would allow me to view the DOM after I modify it dynamically?
Or some suggestions for debugging?


- ianO -

Ian Ornstein - Programmer and Web Developer
IBM Global Services, Global AMS Delivery
(704) 509-8022 

-----Original Message-----
From: .jeff [mailto:jeff at members.evolt.org]
Sent: Monday, October 29, 2001 3:04 PM
To: thelist at lists.evolt.org
Subject: RE: [thelist] JavaScript Question


> From: Ornstein, Ian
> alert(document.forms[0].name);
> Responds with RadioColor.
> alert(document.RadioColor.name);
> Responds with undefined as does
> alert(document.forms['RadioColor'].name);
> The form name is indeed RadioColor.
> I've run out of things to try.
> Suggestions, please.

sorry, what's the question?  



jeff at members.evolt.org

More information about the thelist mailing list