Lương Sơn Bạc  
Trang chủ Lương Sơn Bạc  Lương Sơn Diễn Đàn  Nơi Lưu Trữ: Truyện Ngắn, Truyện Dài, Bài Viết, Nhân Vật, Sách Lịch Sử, Sách Dạy Võ Thuật...   Xem hình thành viên và hình các buổi giao lưu LSB   Nơi Lưu Trữ: Cổ Thi VN, Cổ Thi TQ, Thơ Mới & Các Tuyển Tập Thơ
Quay Lại   Lương Sơn Bạc > Chu Tước Đài > Tin Học > Thiết kế web & forum
Thành viên
Mật khẩu
Những câu hỏi thường gặp Danh sách các thành viên LSB  Lương Sơn Thương Quán
 
 
Tiện ích Chế độ hiển thị
Cũ 08-12-2009   #19
Ảnh thế thân của JavaScriptBank.com
JavaScriptBank.com
-=[ Lâu La ]=-
Gia nhập: 25-04-2009
Bài viết: 20
Điểm: 6
L$B: 2.624
JavaScriptBank.com đang offline
 
Kiểm tra Email

Hiệu ứng sẽ kiểm tra xem chuỗi do người dùng nhập vào có đúng là một dạng thư điện tử hợp lệ kh�... chi tiết tại JavaScriptBank. com - 2.000+ free JavaScript codes

[IMG]hxxp ://w w w.javascriptbank. com/javascript.images/email/validate-e-mail.jpg[/IMG]
Demo: JavaScript Kiểm tra Email
| JavaScript Validate E-Mail

Cách cài đặt

Bước 1: Dùng mã JavaScript để cài đặt hiệu ứng
JavaScript
Code:
<script language="javascript">
// Created by: Francis Cocharrua :: hxxp ://scripts.franciscocharrua. com/

function Validate_String(string, return_invalid_chars) {
  valid_chars = '1234567890-_.^~abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
  invalid_chars = '';
  if(string == null || string == '')
     return(true);

  //For every character on the string.   
  for(index = 0; index < string.length; index++) {
    char = string.substr(index, 1);                        
     
    //Is it a valid character?
    if(valid_chars.indexOf(char) == -1) {
      //If not, is it already on the list of invalid characters?
      if(invalid_chars.indexOf(char) == -1) {
        //If it's not, add it.
        if(invalid_chars == '')
          invalid_chars += char;
        else
          invalid_chars += ', ' + char;
      }
    }
  }
            
  //If the string does not contain invalid characters, the function will return true.
  //If it does, it will either return false or a list of the invalid characters used
  //in the string, depending on the value of the second parameter.
  if(return_invalid_chars == true && invalid_chars != '') {
    last_comma = invalid_chars.lastIndexOf(',');
    if(last_comma != -1)
      invalid_chars = invalid_chars.substr(0, $last_comma) + 
      ' and ' + invalid_chars.substr(last_comma + 1, invalid_chars.length);
    return(invalid_chars);
    }
  else
    return(invalid_chars == ''); 
}


function Validate_Email_Address(email_address){
  // Modified and tested by Thai Cao Phong, JavaScriptBank. com
  //Assumes that valid email addresses consist of [email protected]
  
  at = email_address.indexOf('@');
  dot = email_address.indexOf('.');

  if(at == -1 || 
    dot == -1 || 
    dot <= at + 1 ||
    dot == 0 || 
    dot == email_address.length - 1)
  {
  	alert("Invalid email");
    return(false);
  }
     
  user_name = email_address.substr(0, at);
  domain_name = email_address.substr(at + 1, email_address.length);                  

  if(Validate_String(user_name) === false || Validate_String(domain_name) === false)
  {
  	alert("Invalid email");
    return(false);
  }

  alert("Valid email");//return(true);
}
</script>
	<!--
    	This script downloaded from w w w.JavaScriptBank. com
    	Come to view and download over 2000+ free javascript at w w w.JavaScriptBank. com
	-->
Bước 2: Copy mã HTML bên dưới và dán vào khu vực BODY trên trang web của bạn
HTML
Code:
<form name=f>
<input type=text name=mail value="">
<input type=button value=Check onclick="Validate_Email_Address(document.f.mail.value)">
</form>
	<!--
    	This script downloaded from w w w.JavaScriptBank. com
    	Come to view and download over 2000+ free javascript at w w w.JavaScriptBank. com
	-->

Bạn có thể xem thêm nhiều JavaScript khác về Email




Pop up luôn nổi - Phân trang cho website - Popup luôn ở phía trên

Trả lời kèm theo trích dẫn
 


Quyền sử dụng
Huynh đệ không được phép tạo chủ đề mới
Huynh đệ không có quyền gửi bài trả lời
Huynh đệ không được phép gửi file-gửi-kèm
Huynh đệ không được phép sửa bài của mình

BB code is Mở
Smilies đang Mở
[IMG] đang Mở
HTML đang Tắt
Chuyển nhanh đến:

 
Copyright © 2002 - 2010 Luongsonbac.club
Thiết kế bởi LSB-TongGiang & LSB-NgoDung
Loading

Múi giờ tính theo GMT +7. Hiện giờ là 11:02
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
Liên hệ - Lương Sơn Bạc - Lưu trữ  
Page generated in 0,11915 seconds with 16 queries