i have a form that uses javascript to clear/restore default values when the user clicks on or clicks out of the fields.

<input class="formInput" type="text" name="email" value="Email" onblur="if(this.value == '') this.value = 'Email';" onfocus="if(this.value == 'Email') this.value = '';"/>

and

<textarea class="formInput" name="message" rows="8" cols="50" onblur="if(this.value == '') this.value = 'Message';" onfocus="if(this.value == 'Message') this.value = '';">Message</textarea>

how can i rewrite these functions to be stored in a separate script and only apply to class "formInput" (which i am using for CSS styling)? there are only a few form elements, so there's not much need for loops or scripting for general cases