[thelist] Changing style.backgroundImage of a submit button in js?

Tom Dell'Aringa pixelmech at yahoo.com
Thu Jan 12 15:43:01 CST 2006


Boy, I'm mr. Question today. I'm trying to do a seemingly simple thing - change the background image of a submit button on mouseover (or mousedown, doesn't matter). I wouldn't normally do such a thing, but long story short, I have to in order for our kiosk to do what we want it to.
 
Anyway, I have this code:
 
<input type="submit" name="helpme" style="background: url('/images/btn-helpme.gif'); width: 351px; height: 80px; border: 0;" value="" onmouseover="kbutHitState(this);" />
 
with the function:
 
function kbutHitState(oButton)
 {
  oButton.style.backgroundImage = "url(/'images/btn-helpme_on.gif')";
 }
 
This works fine in FF, but I get a script error in IE: "invalid argument".
 
Does IE not support the access of the backgroundImage property on a submit input? The kluginess(tm) of this is just a-killin me.
 
Tom


More information about the thelist mailing list