Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 27-01-2009
Xan Xan is offline
Member
 
Join Date: Jan 2009
Posts: 576
Validation script for Email Id

i need java script to validate email account .as when I enter one email address for which , i have to validate the mail id, i am unable to validate.so please some one can help me to do this thing ?
Reply With Quote
  #2  
Old 27-01-2009
Member
 
Join Date: Oct 2005
Posts: 2,389
Re: Validation script for Email Id

<script language = "Javascript">

function echeck(str) {

var at="@"
var dot="."
var lat=str.indexOf(at)
var lstr=str.length
var ldot=str.indexOf(dot)
if (str.indexOf(at)==-1){
alert("Invalid E-mail ID")
return false
}

if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
alert("Invalid E-mail ID")
return false
}

if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
alert("Invalid E-mail ID")
return false
}

if (str.indexOf(at,(lat+1))!=-1){
alert("Invalid E-mail ID")
return false
}

if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
alert("Invalid E-mail ID")
return false
}

if (str.indexOf(dot,(lat+2))==-1){
alert("Invalid E-mail ID")
return false
}

if (str.indexOf(" ")!=-1){
alert("Invalid E-mail ID")
return false
}

return true
}

function ValidateForm(){
var emailID=document.frmSample.txtEmail

if ((emailID.value==null)||(emailID.value=="")){
alert("Please Enter your Email ID")
emailID.focus()
return false
}
if (echeck(emailID.value)==false){
emailID.value=""
emailID.focus()
return false
}
return true
}
</script>
Reply With Quote
  #3  
Old 27-01-2009
Member
 
Join Date: Jan 2008
Posts: 1,515
Re: Validation script for Email Id

function validateEmail(strEmail)

{



var at="@"

var dot="."

var lat=strEmail.indexOf(at)

var lstr=strEmail.length var

ldot=strEmail.indexOf(dot)

if (strEmail.indexOf(at)==-1)

{

alert("Invalid E-mail ID")

return false

}

if (strEmail.indexOf(at)==-1 || strEmail.indexOf(at)==0 || strEmail.indexOf(at)==lstr)

{

alert("Invalid E-mail ID")

return false

}

if (strEmail.indexOf(dot)==-1 || str.indexOf(dot)==0 || strEmail.indexOf(dot)==lstr)

{

alert("Invalid E-mail ID")

return false

}

if (strEmail.indexOf(at,(lat+1))!=-1)

{

alert("Invalid E-mail ID")

return false

}

if (strEmail.substring(lat-1,lat)==dot || strEmail.substring(lat+1,lat+2)==dot)

{

alert("Invalid E-mail ID")

return false

}

if (strEmail.indexOf(dot,(lat+2))==-1)

{

alert("Invalid E-mail ID")

return false

}

if (strEmail.indexOf(" ")!=-1)

{

alert("Invalid E-mail ID")

return false

}

return true

}
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Validation script for Email Id"
Thread Thread Starter Forum Replies Last Post
VB script for monitor the scheduled tasks and send Email notification Wendy Windows Server Help 3 14-01-2014 09:38 AM
Cannot compose an email as getting script errors Aanand Windows Software 6 20-08-2010 11:11 AM
Word 2008 + bibfuse: no script in script menu deval4u Software Development 5 06-04-2009 12:53 PM
Problem with script in order to open another script in an extra window Samsher Software Development 2 14-01-2009 01:25 PM
SBS 2003 Prem w/Exchange - forward all email for domain email acct to external email acct Buriim Small Business Server 4 07-03-2008 07:13 AM


All times are GMT +5.5. The time now is 10:54 AM.