• Archives

  • Creating autoclear form fields

    By admin | November 1, 2007

    Whenever you work with forms there is value field like you are working in a text field you will write

    <input type=”text” name=”textfield” value=”welcome” />

    Now that value is displayed adressing you what you have to write there

    How the user will use it he will click on the field and delete the string welcome and write what he has to now if you want not to pain the user using a autoclear field using jscript

    using onFocus

    Syntax

    <input type=”text” name=”n” value=”Your message” onFocus=”if(this.value==’Your message’)this.value=’ ‘;”>

    Note this thing is case sensitive

    means

    Welcome is not equal to welcome

    when changing the welcome string note this point

    And you are done

    Topics: Javascript | 1 Comment »

    Related Links: