我在 一段
<form name="frm" action="xas.php?mod=aaa">
</form>
中进行了JS验证,当 我点击提交按钮的时候,本来是想没有通过验证,action的路径就执行不了,但是不知如何控制!!
以下就是我的那段 点击提交按钮的 function 。帮忙看看还需要怎么加点,才可以防止跳转!?function save_check(){
var flg = 0;
if(! check_resume()){
flg = 1;
}
if(!check_name()){
flg = 1;
}
if(!check_date()){
flg = 1;
}
if(!check_tel()){
flg = 1;
}
if(!check_mail()){
flg = 1;
}
if(flg==0){
return true;
}else{
return false;
}
}
<form name="frm" action="xas.php?mod=aaa">
</form>
中进行了JS验证,当 我点击提交按钮的时候,本来是想没有通过验证,action的路径就执行不了,但是不知如何控制!!
以下就是我的那段 点击提交按钮的 function 。帮忙看看还需要怎么加点,才可以防止跳转!?function save_check(){
var flg = 0;
if(! check_resume()){
flg = 1;
}
if(!check_name()){
flg = 1;
}
if(!check_date()){
flg = 1;
}
if(!check_tel()){
flg = 1;
}
if(!check_mail()){
flg = 1;
}
if(flg==0){
return true;
}else{
return false;
}
}
一:提交的时候,在submit按钮的onclick事件里return false,这样就不会提交了。
二:在form里设置一个onsubmit属性,同样return false,就不会提交数据。