JS怎么实现必填项都填完以及填写格式都正确后再点击提交按钮弹出提交成功,否则提交失败,请重新填写

<form class="yuyue_message" name="order" id="order" action="" method="post" onSubmit="return checkForm();">

<div class="xm">
<label for="name" class="label_label"><span style="color:#F00">*</span> 姓名:</label>
<input type="text" name="usrname" id="usrname" class="input_input" onSubmit="checkName();" placeholder="请输入正确姓名" maxlength="20" size="20" >
</div>

<div class="dlk1">
<label for="sex" class="label_label"><span style="color:#F00">*</span> 性别:</label>
<input type="radio" name="sex" id="sex" value="1" checked="checked" onSubmit="checkSex();" /> 男
<input type="radio" name="sex" id="sex" value="2" onSubmit="checkSex();" /> 女
</div>

<div class="dlk1">
<label for="age" class="label_label"><span style="color:#F00">*</span> 年龄:</label>
<input type="text" name="usrage" id="usrage" class="input_input" placeholder="请输入正确年龄" maxlength="3" onkeyup="value=value.replace(/[^\d]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" onSubmit="checkAge();">
</div>

<div class="dlk2">
<label for="phone" class="label_label"><span style="color:#F00">*</span> 联系方式:</label>
<input type="tel" name="usrtel" id="usrtel" class="input_input" placeholder="请输入正确的联系方式" onSubmit="checkTel();" maxlength="12" size="12">
</div>

<div class="dlk3">
<label for="object" class="label_label"> 预约项目:</label>
<input type="text" name="object" class="input_input" value="近视手术" maxlength="4" disabled="disabled">
</div>

<div class="dlk3">
<label for="yytime" class="label_label"> 预约时间:</label>
<select name="time" id="time" class="input_input">

<option value="1">近一周</option>

<option value="2">近三个月</option>

<option value="3">三个月后</option>

</select>

</div>

<div class="dlk3">
<label for="decrpition" class="label_label1">详细描述:</label>
<textarea name="decrpition" id="decrpition" cols="55" rows="10"></textarea>

</div>
<div class="button3">
<input type="image" src="images/submit.png" id="submit" class="submit" value="提交" onclick="return checkForm();">
<input type="image" src="images/index.png" id="index" class="index" value="返回首页" onclick="">
</div>
</form>

找到这些函数吧,这些应该是校验的,你那里其实已经是配置了很多,但还需要调整一下,没有看到你的全部代码,也不知具体怎么调,建议多用点console来打印值出来,这样你可以看到代码的执行顺序,然后才能判断是哪个环节出错

温馨提示:答案为网友推荐,仅供参考

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网