javascript checkbox

来源:互联网 发布:网络犯罪案件 编辑:程序博客网 时间:2024/05/01 18:49
<html>
<head>
<script type="text/javascript">
function cbox()
{
tt
=document.forms[0].v1
txt
=""
for (i=0;i<tt.length;++ i)
{
if (tt[i].checked)
{
txt
+=tt[i].value + " "
}

}

document.getElementById(
"ss").value="with " + txt
}

</script>
</head>

<body>

<form>
<input type="checkbox" name="v1" value="AA">With AA<br />
<input type="checkbox" name="v1" value="bb">With BB<br />
<br />
<input type="button" onclick="cbox()" value="Send">
<br /><br />
<input type="text" id="ss" size="50">
</form>
</body>

</html>

 
原创粉丝点击