Change of a background image of a button on onclick event
- by Alpan67
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