Example of JS non-empty verification and mailbox verification

   Name:  .... omitted other Input  function check () {if (Document.getlementByid ('Trueename ') .value ==' ') {alert (' must enter your name! '); Document.getElementByid (' trueename '). Focus (); return false;} if (Document.getElementByid (' Identity '). value = = '') {Alert ('must enter the ID number!'); Document.getElementByid ('Identity'). Focus (); Return False;} if (Document.getElementById ('tel'). value == '' ) {alert ('must enter the contact number!'); document.getlementByid ('tel'). Focus (); returnaf false;} if (Document.getElementById ('address'). value ==') {Alert 'Must enter the contact address!'); Document.getElementByid ('address'). Focus (); return false;} if (Document.getElementByid ('WebID'). Value == ') {Alert (' must set employees) account!');Document.getElementByid ('WebID'). Focus (); Return False;} if ('password'). value == '') {Alert ('password can not be empty!'); Document.getElementByid ( 'Password'). FOCUS (); Return false;} if (Document.getElementByid ('password'). Value! = Document.getlementById ('rpass'). Value) {alert ('Two input passwords!' ); Document.getElementByid ('password'). Focus (); returnaf false;}} 
function check () {if ('trueename'). value == ') {Alert ('Must enter your name!'); Document.getlementByid ('trueename'). FOCUS (); return false;} if (Document.getElementById ('Identity'). Value == ') {Alert (' must enter your identity) Dialect number! '); Document.getlementByid (' Identity '). Focus (); return false;} if (Document.getElementByid (' tel '). Value ==') {alert ('must enter contact number!' ); Document.getlementByid ('tel'). Focus (); RETURn false;} f ('address'). value ==') {alert ('must enter the contact address!'); Document.getElementByid ('address'). Focus (); return false;} IF ('WebID'). value == ') {alert (' must set employee account! '); document.getlementByid (' WebID '). Focus (); Return False;} if (Document. getElementByid ('password'). value == ') {alert (' password can not be empty! '); Document.getElementByid (' password '). Focus (); return false;} if (Document.GetElementByid (' password ') .value! = document.getlementByid (' rpass'). Value) {alert ('The password entered twice is inconsistency!'); Document.getElementByid ('passWord'). Focus (); return false;}}
Mailbox verification // verify mailbox format Function ISEMAIL () {var email = document.getElementByid ("zh_e"). Value; if (email == "") {alert ("Please enter the mailbox!");Document.getElementByid ("zh_e"). Focus (); returnaf false;} var pattern = / (([*-za-z0-9]+[_| \_| 】)**[a-za- Z0-9] + @ ([A-ZA-Z0-9] + [_ | \ _ | \.]?) * [A-ZA-Z0-9] + \. [A-ZA-Z] {2 , 3} $ /; stretMail = pattern.test (email); if (stres) {return true;} else {alert ("The mailbox format is incorrect!");}}
Implementation: When the mouse focus leaves text This event is triggered when the frame is faster. Onblur = "iSemail" [onblur () Lost incident when the focus is lost]

The above JS non-air verification and mailbox verification The instance is the full content of Xiaobian sharing to everyone, I hope to give you a reference, I hope everyone will support Tumi Cloud.

© Copyright Notice
THE END
Just support it if you like
like0
share
comment Grab the couch

Please log in to comment