PDA

View Full Version : Add text to an input field, then disappear when selected



javajeff
Mar 5th, 2008, 03:48 PM
I want to add text "Special Offer Code:" to an input field, then have it disappear when the user enters a code. Setting the value adds the text.

<input type="text" name="OfferCode" size="18" class="input2" id="offercode" style="color:#333333; font-style:Arial; font-size:11px;" value="Special Offer Code:">

abduraooft
Mar 5th, 2008, 03:52 PM
input.input2{
color:#333333; font-style:Arial; font-size:11px;
}

<input type="text" name="OfferCode" size="18" class="input2" id="offercode" size="20" maxlength="30" value="Special Offer Code:" onfocus="if(this.value==this.defaultValue) this.value='';" onblur="if(this.value=='') this.value=this.defaultValue;" />??

javajeff
Mar 5th, 2008, 04:02 PM
Thank you very much.