I'm trying to display a popup showing which radio button is selected
and am unable to do so. Every time I try, I get undefined, instead of
the value of the particular form variable I'm trying to get. Here's my
code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Test</title>
</head>
<body>
<form action="">
<input type="radio" name="testvar" value="1"
checked="checke d">option # 1<br>
<input type="radio" name="testvar" value="2">optio n # 2<br>
<input type="radio" name="testvar" value="3">optio n # 3<br>
</form>
<br>
<a href="#" onclick="alert( document.forms[0].testvar.value) ; return
false">click me</a>
</body>
</html>
If I just use the default selections, it seems like I should be getting
an alert that says "1", but I'm not. I'm getting an alert that says
"undefined" and I don't know why. Any ideas would be appreciated -
thanks!