Ver Mensaje Individual
  #4 (permalink)  
Antiguo 11/04/2012, 16:12
Avatar de zalito12
zalito12
 
Fecha de Ingreso: noviembre-2011
Ubicación: Coruña, España
Mensajes: 430
Antigüedad: 12 años, 5 meses
Puntos: 67
Respuesta: Cambiar una imagen por otra al hacer click en un botón...

Esto funciona:
Código HTML:
<head>
<style type="text/css">
.borde-on {
z-index:200;
background-image:url(nexusencendido.png);
width:207px;
height:399px;
}

.borde-off {
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');

  if(menu.className == 'borde-off'){
    menu.className = 'borde-on';
  }
  else{
    menu.className = 'borde-off';
  }
}                     
</script>

</head>
<body>
<br />
<br />
<br />
<br />
<button onclick="encender();">Encender</button>
<br />
<br />
<center><div id="borde" class="borde-off">
<center><img id="bootanimation" src="android/system/media/bootanimation.gif" /></center>
</div>
</body>