here is the email validation script
function isEmail (v) {
var email = /^[a-zA-Z0-9._-]+@([a-zA-Z
if(!email.test(v)) {
alert('Wrong')
}
}
Main Topics
Browse All TopicsCan someone please post some code examples(javascript) that show how to validate a phone number. I only want digits(example: 1231231234 NOT 123-123-1234). If you know of a way to allow international numbers as well that would be great (example this is a phone number from Europe: Phone: +44 20 8390 xxxx). I am not sure if there is a way to show that it is a USA number or a foreign number, but if it is possible that would be great.
Also what is the best way to check that a person typed in a valid email address(Example. test@aol.com NOT test@aol or whatever).
Thanks
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Neat Script for phone no :)
use this for emails
<script>
function varemail()
{
var sCont = document.frm.email;
var sContVal = document.frm.email.value;
var str=new String();
str=sContVal;
var span=new RegExp("[ ]","g");
var rep=str.replace(span,"9");
if (sContVal.length != 0)
{
if(sContVal == '' || isNaN(rep) == false)
{
alert("Please enter email properly [ anand@direct2s.com ]");
sCont.focus();
sCont.select();
return false;
}
var sAtSym = sContVal.indexOf('@')
var sAtSym2 = sContVal.lastIndexOf('@')
var sPeriod = sContVal.lastIndexOf('.')
var sSpace = sContVal.indexOf(' ')
var sLength = sContVal.length - 1
if ( (sAtSym < 2) || (sAtSym != sAtSym2) || (sPeriod <= sAtSym+2) || (sPeriod == sLength ) || (sSpace != -1) )
{
alert("Please enter email properly [ anand@direct2s.com ]");
sCont.focus();
sCont.select();
return false;
}
}
}
there's also server chk's for emails - will send u that as well
K'Rgds
Anand
take a look at this from another thread
<html>
<head>
<script language="javascript">
function validate(emailad) {
a = emailad.split(";")
var exclude=/[^@\-\.\w]|^[_@\.
var check=/@[\w\-]+\./;
var checkend=/\.[a-zA-Z]{2,3}$
for(i=0;i<a.length;i++)
{
emailadd = a[i];
if(((emailad.search(exclud
== -1)){
alert("Incorrect email address!");
return false
}
else {
alert('hello')
//document.form.submit();
}
}
}
</script>
</head>
<body>
<form method="post" action="this.htm">
<input type="text" name="email" onBlur="javascript:validat
<input type="submit">
</form>
</body>
this can be the best possible
http://cflib.org/udf.cfm?I
Example
<cfoutput>
#YesNoFormat(IsEmail("jgui
#YesNoFormat(IsEmail("jgui
#YesNoFormat(IsEmail("jgui
#YesNoFormat(IsEmail("jgui
</cfoutput>
Output
Yes
Yes
Yes
No
Hope that helps
K'Rgds
Anand
I use this Netscape RegEx written library:
http://developer.netscape.
It is really good, it has simple methods for everything. US Number, SSN, International Number, Email Address, Dates, Zip Codes, Credit Cards, and it even has text box validation and has easy ways to warn the user with a message.
CJ
Business Accounts
Answer for Membership
by: CFDevHeadPosted on 2003-10-22 at 09:20:20ID: 9599878
try this
.value)">
<script>
function formIsNumeric(v) {
v = v.replace(/\s+$|^\s*/gi, "");
isNum = new RegExp ("[^0-9]");
if (isNum.test(v)) {
alert('Wrong')
}
}
</script>
<form name="f">
<input type="text" name="t">
<input type="button" value="click here" onClick="formIsNumeric(f.t
</form>