Buenas noches a todos, estoy haciendo un sencillo script que hace que al pulsar un botón si la dirección src de una imagen es A se cambie por B y si ya es B que se cambie por A... Es muy simple, pero no ejecuta como quiero, y por más que lo miro no veo el fallo. A ver si podeis alumbrarme...(:
index.html:
Código HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<style type="text/css">
#borde {
z-index:200;
background-image:url(nexus.png);
width:207px;
height:399px;
}
#bootanimation {
width:170px;
height:250px;
margin-top:69px;
margin-left:-5px;
display:none;
}
</style>
<script type="text/javascript">
function encender() {
var menu = document.getElementById('borde').style.background-image;
if(menu == 'url(nexus.png)'){
document.getElementById('bootanimation').style.display = "block";
menu = 'url(nexusencendido.png)';
}
else if(menu == 'url(nexusencendido.png)'){ {
menu = 'url(nexus.png)';
}
</script>
</head>
<body>
<br />
<br />
<br />
<br />
<button onclick="encender()">Encender</button>
<br />
<br />
<center><div id="borde">
<center><img id="bootanimation" src="android/system/media/bootanimation.gif" /></center>
</div>
</center>
</body>
</html>