|
jgivoni,
The way to select a radiobutton from within JavaScript is by iterating through the array that is created automatically when JavaScript encounters a radiobutton or checkbox type of input.
function setRadio()
{
var rad = document.getElementById(radiobutton);
for (i = 0; i < rad.length; i++)
{
// Perform appropriate test and then use
if (whatever)
{
rad[i].checked = true;
}
}
}
That should check the radio button you're expecting.
I hope this helps,
Ric
|
|
Expert:
|
rcastagna
|
|
Date:
|
Feb 16, 2007
|
|
Time:
|
07:58
|
|
|
|
Votes: Good (0) | Bad (0) Login to rate this answer
|
|
|
Hi Ric,
That works!
Actually I just needed this part:
buttonElement.checked = true
...as I already knew (by Id) which button I wanted to select.
You've answered my question, but I was wondering about your example... it seems to rely on document.getElementById to return an array... Is that correct?
Well, thanks anyway, i'll give you the points.
Jakob
|
|
Expert:
|
jgivoni
|
|
Date:
|
Feb 16, 2007
|
|
Time:
|
08:34
|
|
|
|
Votes: Good (0) | Bad (0) Login to rate this answer
|
|
|
|
|
|
|
This question has been answered, and points have been rewarded to the following experts:
You're welcome however to comment or give additional information or if you wish, you have the ability to write an Answer Summary for this question by clicking on the "Answer Summaries" Tab.
|
|