js获取radio的值:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script language="javascript">
function validateadd()
{
var New=document.getElementsByName("area");
var area;
for(var i=0;i<New.length;i++)
{
if(New.item(i).checked){
area=New.item(i).getAttribute("value");
break;
}
}
alert(area);
}
</script>
</head>
<body>
<label>
<input name="area" type="radio" value="1" checked="checked" />是</label>
<label>
<input name="area" type="radio" value="2" />否</label>
<input name="submit" type="submit" onclick="validateadd();" />
</body>
</html>
除非注明,均为湛蓝天空原创,转载请注明本文网址:http://skyhome.cn/js/166.html