<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>test_001.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
<script type="text/javascript">
function show_result() {
for ( var i = 0; i < myform.show_type.length; i++) {
if (myform.show_type[i].checked) {
var return_value = myform.show_type[i].value; //这里得到单选按钮值
alert(return_value);
}
}
}
</script>
</head>
<body>
<form action="" name="myform">
<input type="radio" name="show_type" value="type1"
checked="checked" />
type1
<input type="radio" name="show_type" value="type2" />
type2<br/>
<input type="button" onclick="show_result()" value="test" />
</body>
</html>
js 获取单选按钮的值
最新推荐文章于 2022-08-10 23:44:20 发布