Web Wiz - Solar Powered Eco Web Hosting

  New Posts New Posts RSS Feed - Problems with javascript
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Topic ClosedProblems with javascript

 Post Reply Post Reply
Author
photoshop_god View Drop Down
Newbie
Newbie
Avatar

Joined: 21 January 2004
Location: United States
Status: Offline
Points: 18
Direct Link To This Post Topic: Problems with javascript
    Posted: 09 February 2004 at 12:25pm

Hi everyone,

I am having problems with some javascript.  I don't write javascript very often so this might be a really easy question to answer.

I have an asp page were people enter in information into a form.  I want to format the phone numbers and the date fields.  This is the script I have so far:

<script language="JavaScript">
function formatPhone(phoneValue)
{

var areaCode, three, four
var areaCode = phoneValue.substring(0, 3);
var three = phoneValue.substring(3, 6);
var four = phoneValue.substring(6, 10);

document.form1.phone.value = "(" + areaCode + ")" + " " + three + "-" + four
}

function formatDate(dateValue)
{
var m, d, y
var m = dateValue.substring(0, 2);
var d = dateValue.substring(2, 4);
var y = dateValue.substring(4, 8);
document.form1.startDate.value = m + "/" + d + "/" + y

}
</script>

Now I have about four places to enter in phone numbers.  If I implement this as is all of the phone fields format the same.  I need each phone field to format seperatly.  Right now I'm using a javascript onblur comand on each field.  Any help would be appriciated!

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.07
Copyright ©2001-2024 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Policy

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2024 Web Wiz Ltd. All rights reserved.