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:








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.