页面刷新以及动态获取控件名的问题 本帖最后由 SDQDboy 于 2009-09-07 08:27:53 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 1.加history.back(-1);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";}}2.php取数组控件的值,最好把name形式改一下for ($i=0; $i<$array_count; $ii++){ echo "<input type='radio' name='radiobutton[".$i."]' value='".$Q_array[$ii]."'>".$Q_array[$ii]; }下面是php获取值print_r($_POST['radiobutton']);//打印出来是个数组$arr=array_values($_POST['radiobutton']);for($j=0;$j<count($arr);$j++){ echo $arr[$j]."<br>";} 表单提交不对<form onsubmit="return checkform();"><input type=submit></form>checkform里,正确则return true,否则return false;这样就能保证没填写完就不提交。 ◥▉▉▉莪用WIN7搭建不起来PHP环境▉▉▉▉◣ php中出现循环重定向问题,如何解决 php如何将空白变成0? 有朋友能发一个最新的支付宝支付的PHP范例么? 这个问题——我的php还缺什么? 如何检测字符串是只有数字0~9和@,且第1个字符必须是数字0~9? 请教存储过程的问题 各位来讨论一下,本人用PHP编程一年多!但我的感觉是PHP没客户会要! 关于文件下载的问题。急急急!!! ?问: 用mail函数写邮件订阅,为什么邮箱里看到的只是 html 原码?有编玛的问题吗? 老规矩,升星了,散分! 高价请个PHPer
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";}
}2.php取数组控件的值,最好把name形式改一下for ($i=0; $i<$array_count; $ii++){ echo "<input type='radio' name='radiobutton[".$i."]' value='".$Q_array[$ii]."'>".$Q_array[$ii]; }下面是php获取值print_r($_POST['radiobutton']);//打印出来是个数组
$arr=array_values($_POST['radiobutton']);
for($j=0;$j<count($arr);$j++){
echo $arr[$j]."<br>";
}
<form onsubmit="return checkform();">
<input type=submit>
</form>
checkform里,正确则return true,否则return false;
这样就能保证没填写完就不提交。