Entry
Using LABEL, how can this be used to select/deselect a radio button associated with it?
May 10th, 2001 13:44
jsWalter,
Try this little sample.
Works great for check boxes too!
Walter
============================
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Radio Button / Label test</title>
</head>
<script language='JavaScript1.2'>
function labelClick ( sentObj )
{
// What is this guys name
objName = sentObj.name;
// Strip off 'lb_'
objName = objName.substr(3, objName.length);
// click on the corrosponding check box
ckObj = eval ( 'document.all.' + objName );
ckObj.click();
ckObj.blur();
}
</script>
<body>
<input type='radio'
name='rdA'
id='one'
value='menu'
checked
XonClick='setOption( this )'>
<span name='lb_one'
id='lb_one'
onClick='labelClick( this )'> Check One </span>
<p>
<input type='radio'
name='rdA'
id='two'
value='button'
XonClick='setOption( this )'>
<span name='lb_two'
id='lb_two'
onClick='labelClick( this )'> Check Two </span>
</body>
</html>