Javascript 单击“下一步”按钮时如何验证我的表单
我正在一步一步地编写表格。其中包括一个jquery脚本,用于划分我的表单。所以在第一个表单中,我只需要放置一个按钮,这就是下一个按钮,将客户机带到下一个表单上 但是我必须处理这个问题,如果我在我的第一个表单上点击下一步按钮,它就会转到另一个表单,而没有验证第一个表单中的部分 这里是按钮代码Javascript 单击“下一步”按钮时如何验证我的表单,javascript,jquery,html,forms,Javascript,Jquery,Html,Forms,我正在一步一步地编写表格。其中包括一个jquery脚本,用于划分我的表单。所以在第一个表单中,我只需要放置一个按钮,这就是下一个按钮,将客户机带到下一个表单上 但是我必须处理这个问题,如果我在我的第一个表单上点击下一步按钮,它就会转到另一个表单,而没有验证第一个表单中的部分 这里是按钮代码 <input name="Next" type="submit" id='button1' value="Next" /> 问题是如何转到另一种形式,但要验证第一种形式。 提前感谢表单验证可
<input name="Next" type="submit" id='button1' value="Next" />
问题是如何转到另一种形式,但要验证第一种形式。
提前感谢表单验证可以像以下表单一样完成:name=“myForm”action=“demo\u Form.asp”onsubmit=“return validateForm()”method=“post” validateform()函数只返回false:如果输入不为false,则本例中的操作将转到demo_form.asp,本例中的操作将转到下一步
作为一个很好的例子,goto:它更复杂,因为它已经有了一种验证形式,所以如果我在分割我的表单的脚本上添加了一个参数,而不是它显示的2,但是我希望包含在我的eg index.html代码中的validition或screipt处于活动状态,有点困惑,我现在除了感谢您的回答之外,请停止张贴重复的问题。
$(".next").click(function(){
if(animating) return false;
animating = true;
current_fs = $(this).parent();
next_fs = $(this).parent().next();
//activate next step on progressbar using the index of next_fs
$("#progressbar li").eq($("fieldset").index(next_fs)).addClass("active");
//show the next fieldset
next_fs.show();
//hide the current fieldset with style
current_fs.animate({opacity: 0}, {
step: function(now, mx) {
//as the opacity of current_fs reduces to 0 - stored in "now"
//1. scale current_fs down to 80%
scale = 1 - (1 - now) * 0.2;
//2. bring next_fs from the right(50%)
left = (now * 50)+"%";
//3. increase opacity of next_fs to 1 as it moves in
opacity = 1 - now;
current_fs.css({'transform': 'scale('+scale+')'});
next_fs.css({'left': left, 'opacity': opacity});
},
duration: 800,
complete: function(){
current_fs.hide();
animating = false;
},
//this comes from the custom easing plugin
easing: 'easeInOutBack'
});