PDA

View Full Version : input type=image image change?


ventura
01-20-2004, 08:45 PM
is it possible to do an image change on an <input type="image">

for instance, i want to be able to validate that a certain checkbox is checked before i make an input button active.

Danne
01-20-2004, 09:22 PM
Try this:

function changeEl(imgRef) {
var p=imgRef.parentNode;
var input=document.createElement("INPUT");
input.type="image";
input.src=imgRef.src;
p.insertBefore(input, imgRef);
p.removeChild(imgRef);
input.onclick=function(e) {
alert('');
}
}

glenngv
01-21-2004, 04:08 AM
code:
document.getElementById("imgButton").src = "enabled_submit.jpg";

html:
<input type="image" src="disabled_submit.jpg" id="imgButton">