TheConeHead
Programmer
How do you bring focus to a member of a radio family
....radioName.focus()
does not work...
![[conehead] [conehead] [conehead]](/data/assets/smilies/conehead.gif)
....radioName.focus()
does not work...
![[conehead] [conehead] [conehead]](/data/assets/smilies/conehead.gif)
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
<html>
<head>
<script type="text/javascript">
function test(choice) {
var myFrm = document.forms[0];
myFrm.myRadio[1].focus();
if (choice) myFrm.myRadio[1].checked = 'checked';
}
</script>
</head>
<body>
<form action="">
<input type="radio" name="myRadio" id="myRadio1" value="1">1<br/>
<input type="radio" name="myRadio" id="myRadio2" value="2">2<br/>
<input type="radio" name="myRadio" id="myRadio3" value="3">3<br/>
</form>
<a href="javascript:test()">Test Focus</a><br/>
<a href="javascript:test('select')">Test Select</a><br/>
</body>
</html>
function setmyfocus(which, index) {
var myFrm = document.forms[0];
if (index) {
myFrm.elements[which][index].focus();
} else {
myFrm.elements[which].focus();
}
}
function setfieldfocus(focusto, type) {
if (type == "radio")
whichform.elements[focusto][0].focus();
else
whichform.elements[focusto].focus();
}