A JavaScript for verifying email address in a form | 太阳帆数据 ...
A JavaScript for verifying email address in a form By Zhanshan Dong on August 25th, 2011 To get a valid email address in a web form, you have to make sure that users enter a valid email address. <a href="http://www.theapparelend.com/index.php"><strong>designer D&G men jeans onsale</strong></a> One way to that is using a javascript to do it. After users enter an email address, use javascript to verify it right way. If the email is valid, move to the next field. Otherwise, popup an alert dialog and highlight the email input box. Allow users <a href="http://www.theapparelend.com/eye-wear-louis-vuitton-c-1021_1083.html"><strong>Louis Vuitton eyewear onsale</strong></a> to modify their inputs. Here is a simply JavaScript code. function verifyEmail(formname, email) { var emailRegEx = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+.[A-Z]{2,4}/i; if (email.search(emailRegEx) == -1) { alert("请输入一个有效的电*邮件地址. "); var myform = window.document.forms[formname]; myform.elements["email"].focus(); } } <a href="http://www.theapparelend.com/men-shoes-supra-c-1017_961.html"><strong>Supra men fashion shoes onsale</strong></a>
|