![Antiguo](http://static.forosdelweb.com/fdwtheme/images/statusicon/post_old.gif)
26/05/2009, 03:54
|
| | Fecha de Ingreso: mayo-2009
Mensajes: 14
Antigüedad: 15 años, 8 meses Puntos: 0 | |
Respuesta: Como crear con javascript un boton que cambie una imagen Tengo que hacerlo con una funcion cambia()
Tengo esto pero no me sale
<html>
<head>
<script type="text/javascript">
var actual = "premio.gif";
function cambia()
{
actual = (actual == "premio.gif") ? "icono_movie.gif" : "premio.gif";
document.getElementById("imagen").src = actual;
}
</script>
</head>
<body>
<img src="premio.gif" width="107" height="98">
<form>
<input type="button" onclick="cambia()" value="Cambiar imagen">
</form>
</body>
</html> |