<Scripttype= "Text/javascript">varleyou=document.getElementById ('j-leyou'), _name=document.getElementById ('J-name'), Mobile=document.getElementById ('J-mobile'), email=document.getElementById ('J-email'); Leyou.onsubmit= function() {console.log (_name.value); if(_name.value=== "') {alert ('nickname cannot be empty'); return false; } if(Mobile.value=== "') {alert ('mobile phone number cannot be empty'); return false; } Else if(Mobile.value.length< One || !/^ (13[0-9]|15[0|3|6|7|8| 9]|18[8|9]) \d{8}$/. Test (Mobile.value)) {Alert ('phone number format is not correct, please re-fill. '); return false; } if(Email.value=== "') {alert ('e-mail cannot be empty'); return false; } Else if (!/^ ([a-za-z0-9_-]) [email protected] ([a-za-z0-9_-]) + ((\.[ a-za-z0-9_-]{2,3}) $/. Test (Email.value)) {Alert ('e-mail format is not correct, please re-fill. '); return false; }}; </Script>
JS nickname, mobile phone number, email judgment