Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

adding string to existing value

Status
Not open for further replies.

rkoya

IS-IT--Management
Joined
Jul 12, 2004
Messages
57
Location
GB
Hi,

I have an input box:

<input name="fldCardExpiryYear" type="text" id="fldCardExpiryYear" value="(CARD_EXPIRY_YEAR)" maxlength="4" size="4" onChange="this.value=validated(this.value)">

This is for the expiry date for a credit card. The customer enters in 2 digits such as 07. I want the field to change to 2007 when they click away from the box. Does anyone one have any idea how to do this.

Thanks




 
To know when the field loses the focus, you can use the onblur event. To concatenate strings you can simply use the + operator.

Cheers,
Dian
 
Thanks, worked perfectly.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top