您的位置:首页 > Web前端 > JavaScript

关于checkbox选中后显示值的问题(通用js)

2006-09-29 16:29 543 查看
<script language=javascript>
function check()
{
//alert(Form1.chkbiz_model.value);
for(var i=0;i<document.Form1.elements.length;i++)
{
//if (document.Form1.elements[i].type=="checkbox"){
if (document.Form1.elements[i].name=="chkbiz_model")
{
if(document.Form1.elements[i].checked == true) alert(document.Form1.elements[i].value);
//document.Form1.elements[i].checked=t;
}

}
}
</script>
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<table cellSpacing="0" cellPadding="0" width="90%" border="0">
<tbody>
<tr>
<td width="24%" height="25"><input type="checkbox" value="生产型" name="chkbiz_model">
生产型
</td>
<td width="24%" height="25"><input type="checkbox" value="贸易型" name="chkbiz_model">
贸易型
</td>
<td width="24%" height="25"><input type="checkbox" value="服务型" name="chkbiz_model"> 服务型
</td>
<td width="28%" height="25"><input type="checkbox" value="政府或其他机构" name="chkbiz_model">
政府或其他机构
</td>
</tr>
</tbody>
</table>
<P><INPUT type="button" value="Button" onclick="check()"></P>
</form>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: