this might be a silly question but i have worked on this for quite a bit and i still can't figure it out. I am creating a form in html that contains a table. Inside a cell from this table, there is a textfield that has "Name" by default. I would like to make "Name" Disappear as soon as I click on the text field.
Here's my row:
<html>
<script type="text/javascript" src="on_click.js"></script>
....
....
<tr>
<td></td>
<td><input type="text" name="addname" value="Name" size="179" onclick="Clear()" id="textbox1"></td>
<td></td>
</tr>
<tr>
<td></td>
<td><input type="text" name="lastname" value="Last" size="179" onclick="clear() id="textbox2"></td>
<td></td>
</tr>
....
</html>
The following is my javascript code:
function Clear()
{
document.getElementById("textbox1").value= "";
document.getElementById("textbox2").value= "";
}
I don't know if maybe i am using the wrong function, or if I'm not including my files correctly inside my javascript or my html. I'm new to javascript and i would greatly appreciate it if someone can help me out with this.
Thank you!!
Aucun commentaire:
Enregistrer un commentaire