Submitted by prashant_agr on Wed, 2007-05-16 08:29.
HTML allows you to use an image as a submit button, but it doesn't provide for images as reset buttons. We can work around that limitation, however, with a little JavaScript. The technique described here allows you to easily create a reset image button. This technique only requires you to write a few lines of code.
First, copy the following JavaScript exactly as-is into your web page. Don't change anything.
http://www.idocs.com/tags/
// Distribute this script freely, but keep this
// notice with the code.
var resetRolls = new Object();
function resetimage(src)
{
this.src=src;
this.confirm=true;
this.alt="Reset";
this.write=resetimage_write;
}
Re: How to use image as reset button in Html form ?
HTML allows you to use an image as a submit button, but it doesn't provide for images as reset buttons. We can work around that limitation, however, with a little JavaScript. The technique described here allows you to easily create a reset image button. This technique only requires you to write a few lines of code.
First, copy the following JavaScript exactly as-is into your web page. Don't change anything.
http://www.idocs.com/tags/
// Distribute this script freely, but keep this
// notice with the code.
var resetRolls = new Object();
function resetimage(src)
{
this.src=src;
this.confirm=true;
this.alt="Reset";
this.write=resetimage_write;
}
function resetimage_write()
{
document.write('');
document.write('');
}
//-->
Now, suppose we want to use this image as our reset button: reset button We'll create our form with this code: