Change of a background image of a button on onclick event

Posted by Alpan67 on Stack Overflow See other posts from Stack Overflow or by Alpan67
Published on 2010-05-29T08:08:26Z Indexed on 2010/05/29 8:12 UTC
Read the original article Hit count: 242

Filed under:
|
|

Why does this not work ? In Firebug, when I click on the button, it always says to me that cambiaBandiera is not defined ...

HELP

Alex

CSS

ITA{

float:right;
margin : 5px 85px;
width:40px;
height:40px;
background : #FFFFFF url("../ITA_off.png") center center no-repeat;
border:0;

}

JAVASCRIPT (in HEAD)

style type="text/javascript"> function cambiaBandiera() { test=document.getElementById("ITA"); test.style.backgroundImage="url('../ITA_on.png')"; }

/style

and this is HTML

div id="bandiere"

input type="button" id="ITA" onClick="cambiaBandiera()" /input /div

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about html