homepage Welcome to WebmasterWorld Guest from 54.204.77.26
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
Checking input box for certain numeric characters
A telephone number area code check.
WibbleWobble




msg:1483880
 12:28 pm on Feb 9, 2004 (gmt 0)

I have truly no idea about javascript, so I'll throw this out there in the hope one of you is kind enough to know how to do this.

We have an input box for telephone numbers, and we need to stop people entering mobile numbers when they should enter landline numbers, so we basically need to check if the number begins with 07 when the form is submitted. Can anyone shed any light upon how to do this?

 

txbakers




msg:1483881
 12:37 pm on Feb 9, 2004 (gmt 0)

if (document.form.field.value.indexOf("07") == 0){
phonenumber begins with 07
} else {
phonenumber doesn't.
}

That's the basics of it.

look to www.w3schools.com for a good tutorial for javascript.

WibbleWobble




msg:1483882
 3:08 pm on Feb 9, 2004 (gmt 0)

That seems almost insultingly easy, cheers :))

I've had a look at those tutorials mentioned, but only when the need arises, which is fairly infrequently. Still, I may have another glance-aroon.

(cheers again)

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved