PDA

View Full Version : Textarea cleared when clicked


mauritz
09-08-2007, 09:44 PM
Hello,

At my pixelpost (1.6) blog, I have 3 input fields, one for your name, one for your site and one for your comment.

<input type='text' name='name' class='inputgegevens' value='Naam*' id="name" onfocus="if(this.value=='Naam*')this.value=''"/>

<input type='text' name='url' class='inputgegevens' value='Website url' id="url" onfocus="if(this.value=='Website url')this.value=''"/>

<textarea name='message' class='input' onfocus="clearBox(this);">Comment here</textarea>

At the top of the page, between the javascript tags, I have this little piece of code:

<!--
function clearBox(box) {
if(box.value==box.defaultValue) {
box.value = "";
}
}
//-->

As you might have noticed, I want all the three fields to be cleared when someone clicks the field.
The 1st and the 2nd field, the ones with the values 'Naam*' and 'Website', are being cleared.

But the last one isn't being cleared at all.

Does anyone know how to get the last field (the textarea) cleared as well?

Kind regards,
Maurits


---
Sorry, wrong subforum.
Could this one be moved to 'Pixelpost Help' please?
---

dakwegmo
09-12-2007, 01:25 PM
Why not just do the same thing you're doing with the first and second fields?

<textarea name='message' class='input' onfocus="if(this.value=='Comment here')this.value=''">Comment here</textarea>