Jump to content
valiantshady

Query: how to create log in text box?

Recommended Posts

Greetings,Hey everyone, I've had a query about how to create a form text box with some value inside that gets automatically cleared as the user clicks on it to edit it, more like this example on www.bodybuilding.com they have a sign in form at the right hand-side next to the flash slide show.. Sorry if my question is not that professional but I can't seem to know how from their source code.. Thanks for your time and effort.. :good:

post-36527-0-01047600-1332986075_thumb.jpg

Share this post


Link to post
Share on other sites

In the <input> onfocus attribute, you use javascript pass a command to the browser to empty the input, when user click (focus) on it with a mouse and the default value is there.EX:

<input type="text" value="Enter name" onfocus="if(this.value=='Enter name'){this.value=''}">

  • Like 1

Share this post


Link to post
Share on other sites
<input type="text" value="Enter name" onfocus="if(this.value==this.defaultValue){this.value=''}" onblur="if(this.value==''){this.value=this.defaultValue}">

  • Like 1

Share this post


Link to post
Share on other sites

Oh my god, eTianbun and dsonesuk you're the best, I really didn't have any idea how to do that..Thanks a lot my friends i am really thankful! :good: :Happy:

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...