21,891
社区成员
发帖
与我相关
我的任务
分享
<script language="javascript">
function checkform(){
var theform = document.form1;
var icount = theform.hiddenField.value;
var checkOK = false;
for(i=1; i<=icount; i++){
var theitem = eval("theform.h_QuestionType" + i.toString());
if (theitem.value==3){
//alert("问答题");
var thetextfield = eval("theform.textfield" + i.toString());
if(thetextfield.value==""){
alert("第" + i.toString() + "题,您还没有做选择!");
return false;
} else{ checkOK = true;}
}
}
if(checkOK){theform.action = "QList.php?id=1";}
}
</script>
<form name="form1" method="post" action="">
<input type="submit" name="Submit" value="提交" onClick="checkform()">
</form>
function checkform(){
var theform = document.form1;
var icount = theform.hiddenField.value;
var checkOK = false;
for(i=1; i<=icount; i++){
var theitem = eval("theform.h_QuestionType" + i.toString());
if (theitem.value==3){
//alert("问答题");
var thetextfield = eval("theform.textfield" + i.toString());
if(thetextfield.value==""){
alert("第" + i.toString() + "题,您还没有做选择!");
history.back(-1);//就加这里了
return false;
} else{ checkOK = true;}
}
}
if(checkOK){theform.action = "QList.php?id=1";}
}
for ($i=0; $i<$array_count; $ii++){ echo "<input type='radio' name='radiobutton[".$i."]' value='".$Q_array[$ii]."'>".$Q_array[$ii]; }
print_r($_POST['radiobutton']);//打印出来是个数组
$arr=array_values($_POST['radiobutton']);
for($j=0;$j<count($arr);$j++){
echo $arr[$j]."<br>";
}