PDA

View Full Version : Clear data in fields within form



toplisek
01-17-2006, 06:06 PM
I have image1 and Image_over
When user goes over image1 it should change image1 to image_over.
When user clicks on image it will clear all fields in form.

How to do without button and JavaScript? Need help

Twey
01-17-2006, 06:35 PM
Without Javascript? Not possible. With Javascript, you can use a form's .reset() method.

toplisek
01-17-2006, 07:08 PM
Pleas etell me whole code with Javascript. I will do but I need without button. My images (over image and base)

Twey
01-17-2006, 07:58 PM
<img src="image_base.png" onmouseover="this.src = 'image_over.png';" onmouseout="this.src = 'image_base.png';" style="display: none;" onclick="this.form.reset();" id="resetImage"/>
<input type="reset" value="Clear" id="resetButton"/>
<script type="text/javascript">
document.getElementById("resetButton").style.display = "none";
document.getElementById("resetImage").style.display = "inline";
</script>That ought to work nicely, as well as providing a non-JS alternative.