Username:                   18962 Registered members
  Register here!
Password:   (Lost your password?)
Bookmark: bookmark | Connect with FB: Connect with facebook!
Enter keyword(s) for search here:  

Making a form clear when clicked



Please Note: Do NOT copy our entire tutorials, we work hard to make these. You are not allowed to translate our tutorials and add them to your site without our permission.

Checked out our Comics yet?

This little javascript can be used to clear a form's value when the user clicks on it:

Code:

Add this code between the <head></head> tags on your page:

<script>
function clearText(thefield){
if (thefield.defaultValue==thefield.value)
thefield.value = ""

</script>


Once done you can now add your forms anywhere on the page and as many as you want like this:

Code:

Add this code between the <body></body> tags on your page:
<form>
<input type="text" value="Enter your e-mail address.." onFocus="clearText(this)">
<input type="text" value="Search this site.." onFocus="clearText(this)">
</form>



Encourage us, share our content:

rssrssstumbleupondeliciousdiggfriendfeedfacebookredditgoogle


Top Comments
No comments have been made on this tutorial.


Please Login to Write a Comment.

Not a Member? It takes just a minute... Register here.


StatisticsTutorial Statistics
Date Added: 19-Jun-2010
Votes: 1
Rating: 10
Views: 3338

Author: DevilsWrath

Message this User
View this User's Profile

Main Category:
JavaScripts Tutorials
Sub-Category:
General Development


Rate this Tutorial:
1 2 3 4 5

Contact UsGet the latest tips and tricks delivered to you!

Subscribe to SurfnLearn, and get the latest tutorials delivered to you for free!

Subscribe by E-mail:  subscribe to our feed

 

Follow our tutorial updates on Follow me on Twitter






Latest Forum Threads

How to Answer Interview Questions
12-08-2012 12:12 by Jayden Bell

hello cw players
12-07-2012 02:19 by cwchef

Help me
12-03-2012 12:41 by vitittam

Simcity Social - Three free Land pe...
11-27-2012 01:53 by DevilsWrath



Site Statistics
Lets see.. 356 users have been online together, the search feature has been used 13144 times, we have 6439 listed tutorials, a total of 3602945 tutorials have been served so far and a total of 18962 registered members.


Donate | Privacy policy | RSS | FAQ's | Contact us
Site maintained and designed by Adnan Usman Copyright © 2008-2011 SnL Tutorial Search Engine.