S
sofie
Hello all,
I use the following javascript function in a html document to set the
level of one of eight available radiobuttons. The line that's
commented out works fine under IE, but I need to rewrite it so that
it's W3C compliant. Reading through earlier messages I concluded I
should go with getElementById but this doesn't work. What am I doing
wrong?
Your help is much appreciated.
Sofie
function SetRadioLevel(iLevel)
{
document.getElementById('radiobutton')[8-iLevel].checked = true;
// document.all.radiobutton[8-iLevel].checked = true;
}
which refers to:
<input type="radio" name="radiobutton"
value="radiobutton" onClick="JavaScript:SetZoomLevel(8)">
<input type="radio" name="radiobutton"
value="radiobutton" onClick="JavaScript:SetZoomLevel(7)">
<input type="radio" name="radiobutton"
value="radiobutton" onClick="JavaScript:SetZoomLevel(6)">
<input type="radio" name="radiobutton"
value="radiobutton" onClick="JavaScript:SetZoomLevel(5)">
<input type="radio" name="radiobutton"
value="radiobutton" onClick="JavaScript:SetZoomLevel(4)">
<input type="radio" name="radiobutton"
value="radiobutton" onClick="JavaScript:SetZoomLevel(3)">
<input type="radio" name="radiobutton"
value="radiobutton" onClick="JavaScript:SetZoomLevel(2)">
<input type="radio" name="radiobutton"
value="radiobutton" onClick="JavaScript:SetZoomLevel(1)">
I use the following javascript function in a html document to set the
level of one of eight available radiobuttons. The line that's
commented out works fine under IE, but I need to rewrite it so that
it's W3C compliant. Reading through earlier messages I concluded I
should go with getElementById but this doesn't work. What am I doing
wrong?
Your help is much appreciated.
Sofie
function SetRadioLevel(iLevel)
{
document.getElementById('radiobutton')[8-iLevel].checked = true;
// document.all.radiobutton[8-iLevel].checked = true;
}
which refers to:
<input type="radio" name="radiobutton"
value="radiobutton" onClick="JavaScript:SetZoomLevel(8)">
<input type="radio" name="radiobutton"
value="radiobutton" onClick="JavaScript:SetZoomLevel(7)">
<input type="radio" name="radiobutton"
value="radiobutton" onClick="JavaScript:SetZoomLevel(6)">
<input type="radio" name="radiobutton"
value="radiobutton" onClick="JavaScript:SetZoomLevel(5)">
<input type="radio" name="radiobutton"
value="radiobutton" onClick="JavaScript:SetZoomLevel(4)">
<input type="radio" name="radiobutton"
value="radiobutton" onClick="JavaScript:SetZoomLevel(3)">
<input type="radio" name="radiobutton"
value="radiobutton" onClick="JavaScript:SetZoomLevel(2)">
<input type="radio" name="radiobutton"
value="radiobutton" onClick="JavaScript:SetZoomLevel(1)">