最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

JS非空驗(yàn)證及郵箱驗(yàn)證的實(shí)例

 更新時間:2017年08月11日 08:08:33   投稿:jingxian  
下面小編就為大家?guī)硪黄狫S非空驗(yàn)證及郵箱驗(yàn)證的實(shí)例。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧

非空驗(yàn)證

<body>
<table>
<tr>
<td>姓名:</td>
<td><input type="text" name="TrueName" id="TrueName" /></td>
</tr>
....省略其他input
<tr>
<td colspan="2">
<input type="submit" value="submit" onclick="return check();" />
</td>
</tr>
</table>

</body>

<script language="JavaScript">
function Check()
{
 if(document.getElementById('TrueName').value=='') {
 alert('必須輸入姓名!');
 document.getElementById('TrueName').focus();
 return false;
 }

 if(document.getElementById('Identity').value=='') {
 alert('必須輸入身份證號碼!');
 document.getElementById('Identity').focus();
 return false;
 }

 if(document.getElementById('Tel').value=='') {
 alert('必須輸入聯(lián)系電話!');
 document.getElementById('Tel').focus();
 return false;
 }

 if(document.getElementById('Address').value=='') {
 alert('必須輸入聯(lián)系地址!');
 document.getElementById('Address').focus();
 return false;
 }

 if(document.getElementById('WebID').value=='') {
 alert('必須設(shè)置員工賬號!');
 document.getElementById('WebID').focus();
 return false;
 }

 if(document.getElementById('PassWord').value=='') {
 alert('密碼不能為空!');
 document.getElementById('PassWord').focus();
 return false;
 }

 if(document.getElementById('PassWord').value!=document.getElementById('RPass').value) {
 alert('兩次輸入的密碼不一致!');
 document.getElementById('PassWord').focus();
 return false;
 }
}
</script>

<script language="JavaScript">
function Check()
{
 if(document.getElementById('TrueName').value=='') {
 alert('必須輸入姓名!');
 document.getElementById('TrueName').focus();
 return false;
 }

 if(document.getElementById('Identity').value=='') {
 alert('必須輸入身份證號碼!');
 document.getElementById('Identity').focus();
 return false;
 }

 if(document.getElementById('Tel').value=='') {
 alert('必須輸入聯(lián)系電話!');
 document.getElementById('Tel').focus();
 return false;
 }

 if(document.getElementById('Address').value=='') {
 alert('必須輸入聯(lián)系地址!');
 document.getElementById('Address').focus();
 return false;
 }

 if(document.getElementById('WebID').value=='') {
 alert('必須設(shè)置員工賬號!');
 document.getElementById('WebID').focus();
 return false;
 }

 if(document.getElementById('PassWord').value=='') {
 alert('密碼不能為空!');
 document.getElementById('PassWord').focus();
 return false;
 }

 if(document.getElementById('PassWord').value!=document.getElementById('RPass').value) {
 alert('兩次輸入的密碼不一致!');
 document.getElementById('PassWord').focus();
 return false;
 }
}
</script>

郵箱驗(yàn)證

<script type="text/javascript">
//驗(yàn)證郵箱格式
function isEmail() 
{
  var email=document.getElementById("zh_e").value;
 if(email=="")
 {
 alert("請輸入郵箱!");
  document.getElementById("zh_e").focus();
  return false; 
 }
 var pattern= /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
 strEmail=pattern.test(email);
   if (strEmail)
    { 
 return true;
 }
 else
   {
 alert("郵箱格式不正確!");
 }
}
</script>
實(shí)現(xiàn)功能:當(dāng)鼠標(biāo)焦點(diǎn)離開文本框時觸發(fā)該事件。onblur=“isEmail” [ onblur()失去焦點(diǎn)時觸發(fā)事件 ]
<body>
<input type="text" maxlength="32" style="width:220px;" onblur="isEmail()" id="zh_e"/>
</body>

以上這篇JS非空驗(yàn)證及郵箱驗(yàn)證的實(shí)例就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論

湘潭县| 柳河县| 衡东县| 广州市| 宁强县| 黄陵县| 双牌县| 饶河县| 湘阴县| 梁山县| 新邵县| 灵璧县| 若尔盖县| 密云县| 齐齐哈尔市| 杭锦旗| 石楼县| 景宁| 海淀区| 延安市| 宁远县| 漳浦县| 浮梁县| 安丘市| 龙泉市| 顺义区| 冷水江市| 旌德县| 贡山| 英山县| 通榆县| 三台县| 乐昌市| 武邑县| 青州市| 礼泉县| 保德县| 青海省| 靖西县| 偏关县| 新干县|