现在表单是一个表单,这是新的破解代码
<script language="javascript" type="text/javascript">
function verifyIt(){
if((document.form1.baseline_08.value != "" && Number(document.form1.baseline_08.value) && document.form1.baseline_08.value != "-1")){
if((document.form1.baseline_09.value != "" && Number(document.form1.baseline_09.value) && document.form1.baseline_09.value != "-1")){
document.form1.submit();
return true;
}else{
alert("Please select how old you were when you started smoking every day.");
return false;
}
}
function submit2(){
document.form1.direction.value = "back";
document.form1.submit();
}
</script>
现在验证根本不起作用。我现在不知道这有什么问题。
我遇到的问题是form1是唯一被识别的。我相信这是因为我的if语句结构。基本上我只从form1获得返回。我的js出了什么问题?
答案 0 :(得分:1)
我认为这是因为我的if语句结构。
是的,检查return
后,您始终form1
。但是,您不能一次提交多个表单,因此您应将它们合并为一个表单。然后使用
function verifyIt() {
if(!(document.form.baseline_08.value == "" && Number(document.form.baseline_08.value) && document.form.baseline_08.value != "-1")){
alert("Please select how old you were when you started smoking every day.");
return false;
}
if(!(document.form.baseline_09.value != "" && Number(document.form.baseline_09.value) && document.form.baseline_09.value != "-1")){
alert("Please select when you would smoke after waking up.");
return false;
}
document.form.submit();
}