[Javascript] chopping up a string?

Paul McGuire pmcguire at cguk.co.uk
Mon Nov 17 04:06:04 CST 2003


Hi Guys n gals,

I need to be able to break up a numeric form field in JS and turn it into a
date format for example:

someone enters 10 into the text box, the JavaScript needs to change it to
10/10/03 (or whatever the current date is!)

likewise if they enter 1010 the JS should change it to 10/10/03 etc.

I am familiar with capyuring the data and passing it to a function and then
passing it back to the text field. However counting andchopping up the
string is something  I cant do. if 1010 is entered I need to know how to
count there are 4 numbers split them into10/10 and grab the current year and
add /03 to the end.

Any Help would be apreciated.

Paul




More information about the Javascript mailing list