转自百度知道

"

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>

<body>
a 
  <input type=checkbox  value="t" name="t" >
b
<input type=checkbox value="x" name="x" />
c
<input type=checkbox value="x" name="x" />
d
<input type=checkbox value="x" name="x" />
<input type="button" value="确定" name="b" onClick="onClick()">
<INPUT type=reset value=重做 name="Reset">
<br>
<input name="yourResult" type="text" >
<script language="JavaScript" type="text/javascript">
function onClick()
{
 var ChkboxValue = "";
 var chks = document.getElementsByTagName("INPUT");  
 for(var i=0; i<chks.length; i++)     
 {       
  if(chks[i].type=="checkbox" && chks[i].checked ) 
  { 
   if ( ChkboxValue == "" )
    ChkboxValue = chks[i].value;
   else
    ChkboxValue += ","+chks[i].value;
  }   
 }
 if (ChkboxValue == "")
  ChkboxValue = "你没有选择!";
 else
  ChkboxValue = "你选择的结果是:"+ChkboxValue;
 document.getElementById("yourResult").value = ChkboxValue;
}
</script>
</body>
</html>

"

相关文章:

  • 2021-06-05
  • 2022-01-31
  • 2022-12-23
  • 2021-10-20
  • 2021-10-21
  • 2022-12-23
  • 2022-02-08
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-17
  • 2022-12-23
  • 2021-11-02
  • 2021-12-29
相关资源
相似解决方案