• Downloading from our site will require you to have a paid membership. Upgrade to a Premium Membership from 10$ a month today!

    Dont forget read our Rules! Also anyone caught Sharing this content will be banned. By using this site you are agreeing to our rules so read them. Saying I did not know is simply not an excuse! You have been warned.

Hỏi cách bắt lỗi @ ở phần nhập email trong js

Entry

New Member
ai giúp em với ạ ý thứ ai của bài ý
 

Attachments

  • Capture.jpg
    Capture.jpg
    19.5 KB · Views: 292
ai giúp em với ạ ý thứ ai của bài ý
Cái này em dùng regex thôi đơn giản anh viết như sau
Code:
<script type="text/javascript">
function kiemtra(thudientu)
{
var giatri = false;
var regex = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if(regex.test(thudientu))
{
giatri = true;
}
return giatri;
}
</script>
<script type="text/javascript">
var thudientu = 'tenuser@domain01.domain02';
if(kiemtra(thudientu))
{
alert('Địa chỉ thư điện tử bạn nhập chính xác');
}
else
{
alert('Vui lòng nhập chính xác địa chỉ thư điện tử của bạn');
}
</script>
 

Facebook Comments

Similar threads

New posts New threads New resources

Back
Top