<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="javascript">
function s()
{
if(person.sex.value=="男")
{
alert("先生您好")
;}
else
{
alert("女士您好");}
}
</script>
<title>无标题文档</title>
</head>
<body>
<form name="person">
<input type="radio" name="sex" value="男" checked>男
<input type="radio" name="sex" value="女">女<br>
<input type="button" value="确定" onClick="s()">
</form>
</body>
</html>
试试这么写。。
for(var i = 0;i<person.sex.length;i++){