form text

windows

Guest
how do you take away the default text in a form input field when the user clicks in the box?<!--content-->hmm... you can do this with the help of javascript<br />
<br />
here is the code<br />
<br />
<form name="click"><br />
<input type="text" name="text" size="20" value="hello" onclick=' document.click.text.value = "" '><br />
</form><br />
<br />
the size of the test box is 20, the default text is "hello", when a user click the text box, document.click.text.value = "" sets the value of the text box to "" which is same as nothing!<br />
<br />
or you can do it by browsing to a function<br />
<br />
put this script in <head></head><br />
<br />
<script language="javascript"><br />
function change()<br />
{<br />
document.click.text.value = ""<br />
}<br />
</script><br />
<br />
put this script in <body></body><br />
<br />
<form name="click"><br />
<input type="text" name="text" size="20" value="hello" onclick="change()"><br />
</form><br />
<br />
hope this helps<!--content-->thanks michael.<!--content-->
 
Back
Top