> "Stefan Finzel" <St***************@T-Online.de> wrote:
news:dh*************@news.t-online.com....
what's the right way to add ONCLICK to a form button using
javascript?
<HTML>... <INPUT ID="RESET" NAME="RESET" TYPE="RESET" VALUE=" Reset
">No onclick is used here
<SCRIPT TYPE="text/javascript">... form.RESET.click =
"javascript:reset_action();" ... </SCRIPT>
If you want to run some javascript when the form is reset you may
want to consider using onreset=""
<form action="javascript
:void();" id="myform" name="myform"
onreset="alert('well done grasshopper')">
Add onreset to form:
document.forms['myform'].onreset =
function r(){alert('well done grasshopper')};
OR add using Id
document.getElementById('myform').onreset =
function r(){alert('well done grasshopper')};
Add onclick:
document.forms['myform'].elements['reseta'].onclick =
function r(){alert('well done grasshopper')};
OR add using Id
document.getElementById('reseta').onclick =
function r(){alert('well done grasshopper')};
<form action="javascript
:void();" id="myform" name="myform">
<input id="reseta" name="reseta" type="reset" value=" Reset ">
</form>
--
BootNic Sunday, October 02, 2005 8:43 PM
Thirty-five is when you finally get your head together and your body starts falling apart.
*Caryn Leschen*