onreset event In java Script

This event gets fired when user clicks on the reset button on a form. A form contains reset button which fires onreset event when it is clicked resulting it vacates all the filled objects like textbox , checkboxes etc.
 
Example:
 
<html>

<head>

<title>events </title>

</head>

<body bgcolor=red text=”white” >

<form name=”sandeep” onreset=”alert(‘ This form is being reseted’)”>

Name : <input type=”text” name=t1 id=”tt1″ > <br>

Address : <input type=”text” name=t2 > <br>

<input type=”reset” name=”b1″> <br>

</form>

</body>

</html>

click here to view results of this program on browser
 
Example:
 
<html>

<head>

<title>events </title>

</head>

<body bgcolor=red text=”white” >

<form name=”sandeep” onreset=”pp()”>

Name : <input type=”text” name=t1 id=”tt1″ > <br>

Address : <input type=”text” name=t2 id=”tt2″ > <br>

<input type=”reset” name=”b1″ id=”bb1″> <br>

</form>

<script>

function pp()

{

document.all.tt1.style.background=’yellow’ document.all.tt2.style.background=’yellow’ document.all.bb1.style.background=’red’ document.all.bb1.style.color=’white’ document.bgColor=’magenta’

}

</script>

</body>

</html>

Scroll to Top