Hey guys, so i'm not great with JavaScript since i mostly do HTML and C++...

ok, so i have a site with a "contact" box that sends me the users message. i want the text to clear when the user clicks on it, but for some reason, i can't get it right...

any help?

this is the html so far...

...

<form action="gdform.asp" method="post">
<input type="hidden" name="subject" value="Message from User" />
<input type="hidden" name="redirect" value="index.htm" />

<FONT size="2"><p align="center">
<INPUT type="text" name="Email Address" value="your email" id="Email Address" size="40"></text>
<FONT size="2"><p align="center">

<textarea name="Message" id="Message" cols="30" rows="5">message...</textarea>
<p align="center"><INPUT type="submit" name="Submit" value="Send">
<INPUT type="reset" name="reset" value="Cancel">
</FORM>

Edited 1 Year Ago by Dani: Formatting fixed

All of your tags should be lowercase.

You need JavaScript to do something dynamic such as what you want..

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
 <HEAD>
  <TITLE> New Document </TITLE>
  <META NAME="Generator" CONTENT="">
  <META NAME="Author" CONTENT="">
  <META NAME="Keywords" CONTENT="">
  <META NAME="Description" CONTENT="">
  <script type="text/javascript">
  function ValidateEmail(){
    document.getElementById('Email Address').innerText = "";
  }
  function ValidateMessage(){
    document.getElementById('Message').innerText = "";
  }
  function Validate(){
    document.getElementById('Email Address').innerText = "";
    document.getElementById('Message').innerText = "";
  }
  </script>
 </HEAD>
 <BODY>
<form action="gdform.asp" method="post">
<input type="hidden" name="subject" value="Message from User" />
<input type="hidden" name="redirect" value="index.htm" />
<p align="center">
<INPUT type="text" name="Email Address" value="your email" id="Email Address" size="40" onClick="ValidateEmail()"></p>
<p align="center"><textarea name="Message" id="Message" cols="30" rows="5" onClick="ValidateMessage()">message...</textarea></p>
<p align="center"><INPUT type="submit" name="Submit" value="Send">
<INPUT type="button" name="reset" value="Cancel" onClick="Validate()">
</p>
</FORM> 
 </BODY>
</HTML>

I HOPE THIS WILL HELP YOU

Edited 3 Years Ago by mike_2000_17: Fixed formatting

This article has been dead for over six months. Start a new discussion instead.