Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    308
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Help with Auto Clearing form element script

    Here's the script:

    http://www.javascriptkit.com/script/...ormclear.shtml

    Is it possible to:

    1. modify it so that the default text/value is re-populated if you click elsewhere?

    2. have the default text/value gray and the text that you type black?

    Thanks,
    Ash

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Posts
    626
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yes it is possible, but wouldn't that annoy people?

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    308
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That's subjective. It wouldn't annoy me.

    Anyone?

  • #4
    teh Moderatorinator
    Join Date
    Sep 2004
    Location
    USA
    Posts
    2,472
    Thanks
    4
    Thanked 40 Times in 40 Posts
    Heres an example:
    Code:
    <input type="text" name="text1" value="Click here" onfocus="if(this.value=='Click here')this.value='';" onblur="if(this.value=='')this.value='Click here';">
    Last edited by Brandoe85; 01-06-2005 at 05:07 AM.

  • #5
    Regular Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    308
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Cool, that works for #1. Any suggestions for #2?

    Thanks,
    Ash

  • #6
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    <input type="text" name="text1" style="color:gray" value="Click here" onfocus="if (this.value=='Click here'){this.value=''; this.style.color='black'}" onblur="if (this.value==''){this.value='Click here'; this.style.color='gray'}" />
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •