Here's a quicky that I only testing in IE.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>test</title>
<script type="text/javascript">
function checkPhone(sPhone){
if(sPhone) {
//put passed url into new var
var sNewPhone = sPhone;
//create array of special replace characters
var vReplace = new Array("(", ")", "-", "[", "]");
//loop through special character array
for(iChr = 0; iChr < vReplace.length; iChr ++) {
//loop through url and replace special characters till they are all gone
do {
sNewPhone = sNewPhone.replace(vReplace[iChr], "");
}
while (sNewPhone.indexOf(vReplace[iChr]) > 0);
}
if(sNewPhone.length < 10){
alert("Ths number " + sPhone + " is too short");
} else {
alert(sNewPhone + " is all good");
}
}
}
</script>
</head>
<body>
<input type="Text" onblur="javascript:checkPhone(this.value);">
</body>
</html>
----- Original Message -----
From: "bajaria aslam" <[EMAIL PROTECTED]>
there is a form text box that asks the user to type in
the phone number. What i have to do is to strip out
characters like dashes and brackets from the
telephonenumber field and then count the number of
characters. If the number of characters is less than
ten, then, i am supposed to give an alert message.
can someone show me how to write the JS code for
stripping the unnecessary characters and counting the
number of characters.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=6
Subscription:
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=6
Signup for the Fusion Authority news alert and keep up with the latest news in
ColdFusion and related topics.
http://www.fusionauthority.com/signup.cfm