JavaScript Scripts





Español Français 中文 Deutsch Portuguese Japanese nederlands
   
 
Free Java Script Codes
Javascript List All
Slide Show Slide Show
Ad Display Ad Display
Image Effect Image Effect
Animated Image Effects Animated Image Effects
Form Validation Form Validation
Color Picker Tool Color Picker Tool
Formatting Forms Formatting Forms
Select All Select All
Dynamic Form Select Dynamic Form select
Dynamic Color Dynamic Color
Calendar Script Calendar
Textbox Counter Textbox Counter
Alphanumeric Alphanumeric
Date Time Script Date & Time
Stop Watch Script Stop Watch script
Delete Repeated Values Delete Repeated Values
Pagination Pagination
Random Generator Random Generator
Animated Text Animated Text
Cursor Position Cursor Position
User Info Window / User Info
Security Security / Authenticate
Bookmark Bookmark
Mouse Effects Mouse Effects
Title Bar Title Bar
Status Bar Status Bar
Country List Country List
Free Games Free Games
Calculators Calculators
 




Multiple Email-id Validation Script


About
This javascript is used to find whether given email-ids are valid or not.


Features
a) You can validate multiple email-ids using this javascript function.
b) Just copy the code into your page and use it.

Preview
Give one email-id per line. Dont give "Enter" after last email-id.





Code
 Javascript Code
<!-- Script by hscripts.com !-->
<script type="text/javascript">

function checkMailId(mailids)
{
var arr = new Array(
'.com','.net','.org','.biz','.coop','.info','.museum','.name','.pro',
'.edu','.gov','.int','.mil','.ac','.ad','.ae','.af','.ag','.ai','.al',
'.am','.an','.ao','.aq','.ar','.as','.at','.au','.aw','.az','.ba','.bb',
'.bd','.be','.bf','.bg','.bh','.bi','.bj','.bm','.bn','.bo','.br','.bs',
'.bt','.bv','.bw','.by','.bz','.ca','.cc','.cd','.cf','.cg','.ch','.ci',
'.ck','.cl','.cm','.cn','.co','.cr','.cu','.cv','.cx','.cy','.cz','.de',
'.dj','.dk','.dm','.do','.dz','.ec','.ee','.eg','.eh','.er','.es','.et',
'.fi','.fj','.fk','.fm','.fo','.fr','.ga','.gd','.ge','.gf','.gg','.gh',
'.gi','.gl','.gm','.gn','.gp','.gq','.gr','.gs','.gt','.gu','.gv','.gy',
'.hk','.hm','.hn','.hr','.ht','.hu','.id','.ie','.il','.im','.in','.io',
'.iq','.ir','.is','.it','.je','.jm','.jo','.jp','.ke','.kg','.kh','.ki',
'.km','.kn','.kp','.kr','.kw','.ky','.kz','.la','.lb','.lc','.li','.lk',
'.lr','.ls','.lt','.lu','.lv','.ly','.ma','.mc','.md','.mg','.mh','.mk',
'.ml','.mm','.mn','.mo','.mp','.mq','.mr','.ms','.mt','.mu','.mv','.mw',
'.mx','.my','.mz','.na','.nc','.ne','.nf','.ng','.ni','.nl','.no','.np',
'.nr','.nu','.nz','.om','.pa','.pe','.pf','.pg','.ph','.pk','.pl','.pm',
'.pn','.pr','.ps','.pt','.pw','.py','.qa','.re','.ro','.rw','.ru','.sa',
'.sb','.sc','.sd','.se','.sg','.sh','.si','.sj','.sk','.sl','.sm','.sn',
'.so','.sr','.st','.sv','.sy','.sz','.tc','.td','.tf','.tg','.th','.tj',
'.tk','.tm','.tn','.to','.tp','.tr','.tt','.tv','.tw','.tz','.ua','.ug',
'.uk','.um','.us','.uy','.uz','.va','.vc','.ve','.vg','.vi','.vn','.vu',
'.ws','.wf','.ye','.yt','.yu','.za','.zm','.zw');

var sd = mailids;
var ids = sd.split("\n");
var val = true;
var beforeat="";
var afterat="";
var afterat2="";
var invalid=false;


for(var j=0; j<(ids.length); j++)
{
	var temp = "wrong";
	var mai = ids[j];

	if(mai.charCodeAt(mai.length-1)==13)
		mai=mai.substring(0,mai.length-1);
	
	var dot = mai.lastIndexOf(".");
	var con = mai.substring(dot,mai.length);
	con=con.toLowerCase();
	con=con.toString();
	
	for(var i=0; i<(arr.length); i++)
	{
		if(con == arr[i])
		{
			temp='right';
		}
	}

	if(temp=="wrong")
		val=false;
	
	var att=mai.lastIndexOf("@");
	beforeat=mai.substring(0,att);
	beforeat=beforeat.toLowerCase();
	beforeat=beforeat.toString();
	var asci1=beforeat.charCodeAt(0);
	
	afterat=mai.substring(att+1, dot);
	afterat=afterat.toLowerCase();
	afterat=afterat.toString();
	
	afterat2=mai.substring(att+1, mai.length);
	afterat2=afterat2.toLowerCase();
	afterat2=afterat2.toString();
	
	if(beforeat=="" || afterat=="" || beforeat.length>30)
		val=false;

	if(afterat2.length>64 || afterat.length<2)
		val=false;

	if((afterat.charCodeAt(0))==45 || (afterat.charCodeAt(afterat.length-1))==45)
		val=false;
		
	if(val==true)
	{
		if(asci1 > 47 && asci1 < 58)
			val=false;
		
		if(asci1 < 48 || asci1 > 57)
		{
			for(var k=0; k<=beforeat.length-1; k++)
			{
				var asci2=beforeat.charCodeAt(k);
				if((asci2<=44 || asci2==47) || (asci2>=58 && asci2<=94) || (asci2==96) || (asci2>=123 && asci2<=127))
				{
					val=false;
					break;
				}
			}
		
			for(var m=0; m<=afterat.length-1; m++)
			{
				var asci3=afterat.charCodeAt(m);
				if((asci3<=44) || (asci3==46) || (asci3==47) || (asci3>=58 && asci3<=96) || (asci3>=123 && asci3<=127))
				{
					val=false;
					break;
				}
			}	
		}
	}
	
	if(val==false)
	{
		invalid=true;
		break;
	}
}
if(invalid==true)
{
	alert("Your maild "+mai+" is not valid");	
	return false;
}
else
{
	return true;
}

}
</script>
<Script by hscripts.com>


HTML Code
<form name="test" onSubmit="return checkMailId(test.mailf.value)">
Give one email-id per line. Dont give "Enter" after last email-id.
<textarea name=mailf type=text rows=5 cols=15></textarea>
<input type=submit value=test></form>

Release Date - 02-01-2005
Get free version without ©copyright link for just 5 price

For customization of this script or any script development, contact us at support@hscripts.com


Usage
Here we have explained with a form
 a)Creating a form
 <form name="test" onSubmit="return checkMailId(test.mailf.value)">
 <textarea name=mailf type=text rows=5 cols=15></textarea>
 <input type=submit value=test></form>

 b)Copy the code into your page.
 c)If user enters multiple email ids in the textarea, the function "onSubmit="return checkMailId(test.mailf.value)"" is called to check whether the entered email-ids are valid. If entered email-ids are not valid then an alert message will appear to re-enter.



License
- The javascript (misspelled as java script) is given under GPL License
- i.e. Free use for those who use the codes as it is.
- Free, if your modification does not remove our copyright information and links.
- Click Here for detailed license information.
- You can purchase the script if your requirements does not meet our GPL License terms.
Other Links

web hosting