87,917
社区成员
发帖
与我相关
我的任务
分享
<form action="" method="post" name="voteform" id="voteform" onsubmit="return Check();">
<table>
<tr>
<td width="75"></td>
<td colspan="4" class="votetitle" height="18">A</td>
<tr>
<tr>
<td width="75"></td>
<td width="140"><input type="checkbox" name="conditions[]" value="1" />1</td>
<td width="140"><input type="checkbox" name="conditions[]" value="2" />2</td>
<td width="140"><input type="checkbox" name="conditions[]" value="3" />3</td>
<td width="140"><input type="checkbox" name="conditions[]" value="4" />4</td>
</tr>
<tr>
<td width="75"></td>
<td colspan="4" class="votetitle" height="18">B</td>
<tr>
<tr>
<td width="75"></td>
<td width="140"><input type="checkbox" name="hstyle[]" value="1" />1</td>
<td width="140"><input type="checkbox" name="hstyle[]" value="2" />2</td>
<td width="140"><input type="checkbox" name="hstyle[]" value="3" />3</td>
<td width="140"><input type="checkbox" name="hstyle[]" value="4" />4</td>
</tr>
<tr><td colspan="5" height="15"></td></tr>
<tr>
<td colspan="5" class="votetitle" height="18" align="center"><input type="submit" name="submit" value="提交"/></td>
<tr>
</table>
</form>
<script>
function Check(){
var num = document.getElementsByName("conditions[]") ;
for(var i=0;i<num.length;i++){
if(num[i].checked == true)
alert("吓死爹啊");
}
}
</script>
<script>
function Check(){
var num = document.voteform.elements.["conditions[]"];
for(var i=0;i<num.length;i++){
if(num[i].checked == true)
alert("吓死爹啊");
}
}
</script>
<html>
<head>
<script>
function Check(form){
var obj = form.elements["conditions[]"];
var arr = [];
arr.push("conditions[]: ");
for(var i = 0; i < obj.length; i++){
if(obj[i].checked){
arr.push(obj[i].value);
}
}
var obj1 = form.elements["hstyle[]"];
arr.push(" hstyle[]: ");
for(var i = 0; i < obj1.length; i++){
if(obj1[i].checked){
arr.push(obj1[i].value);
}
}
alert(arr.join(","));
return false;
}
</script>
</head>
<body>
<form action="" method="post" name="voteform" id="voteform" onsubmit="return Check(this);">
<table>
<tr>
<td width="75"></td>
<td colspan="4" class="votetitle" height="18">A</td>
<tr>
<tr>
<td width="75"></td>
<td width="140"><input type="checkbox" name="conditions[]" value="1" />1</td>
<td width="140"><input type="checkbox" name="conditions[]" value="2" />2</td>
<td width="140"><input type="checkbox" name="conditions[]" value="3" />3</td>
<td width="140"><input type="checkbox" name="conditions[]" value="4" />4</td>
</tr>
<tr>
<td width="75"></td>
<td colspan="4" class="votetitle" height="18">B</td>
<tr>
<tr>
<td width="75"></td>
<td width="140"><input type="checkbox" name="hstyle[]" value="1" />1</td>
<td width="140"><input type="checkbox" name="hstyle[]" value="2" />2</td>
<td width="140"><input type="checkbox" name="hstyle[]" value="3" />3</td>
<td width="140"><input type="checkbox" name="hstyle[]" value="4" />4</td>
</tr>
<tr><td colspan="5" height="15"></td></tr>
<tr>
<td colspan="5" class="votetitle" height="18" align="center"><input type="submit" name="submit" value="提交"/></td>
<tr>
</table>
</form>
</body>
</html>
<script>
function Check(){
var cond=document.getElementByName("conditions[]");
for(var i=0;i<cond.length;i++){
if(conditions[i].checked=true)
alert("吓死爹啊");
}
}
</script>