cambiar tamaño imagen con onmouseover

(1/1)

viher:
hola,yo tengo el siguiente código con mouseover

Código
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<SCRIPT LANGUAGE="javascript">
<!-- Begin
loadImage1 = new Image();
loadImage1.src = "http://img100.xvideos.com/videos/thumbs/0/8/7/0870cc6a3cd66f55c48e8cf241c4c268.2.jpg";
staticImage1 = new Image();
staticImage1.src = "http://img100.xvideos.com/videos/thumbs/0/8/7/0870cc6a3cd66f55c48e8cf241c4c268.1.jpg";
// End -->
</script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin título</title>
</head>
 
<body>
<a href="http://img100.xvideos.com/videos/thumbs/0/8/7/0870cc6a3cd66f55c48e8cf241c4c268.3.jpg" onmouseover="image1.src=loadImage1.src;" onmouseout="image1.src=staticImage1.src;">
<img name="image1" src="http://img100.xvideos.com/videos/thumbs/0/8/7/0870cc6a3cd66f55c48e8cf241c4c268.1.jpg" border=0></a>
</body>
</html>

el caso es que querria que cuando pase el raton por encima la imagen que está puesta se pusiera por ejemplo la propiedad height="100%" y width="100%" pero he estado probando y no lo consigo,he hecho lo siguiente:

Código
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<SCRIPT LANGUAGE="javascript">
<!-- Begin
loadImage1 = new Image();
loadImage1.src = "http://img100.xvideos.com/videos/thumbs/0/8/7/0870cc6a3cd66f55c48e8cf241c4c268.2.jpg";
staticImage1 = new Image();
staticImage1.src = "http://img100.xvideos.com/videos/thumbs/0/8/7/0870cc6a3cd66f55c48e8cf241c4c268.1.jpg";
// End -->
</script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin título</title>
</head>
 
<body>
<a href="http://img100.xvideos.com/videos/thumbs/0/8/7/0870cc6a3cd66f55c48e8cf241c4c268.3.jpg" onmouseover="image1.src=loadImage1.src; image1.width=100%;" onmouseout="image1.src=staticImage1.src;">
<img name="image1" src="http://img100.xvideos.com/videos/thumbs/0/8/7/0870cc6a3cd66f55c48e8cf241c4c268.1.jpg" border=0></a>
</body>
</html>

como seria? gracias

Franki:
Código
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<SCRIPT LANGUAGE="javascript">
<!-- Begin
loadImage1 = new Image();
loadImage1.src = "http://img100.xvideos.com/videos/thumbs/0/8/7/0870cc6a3cd66f55c48e8cf241c4c268.2.jpg";
staticImage1 = new Image();
staticImage1.src = "http://img100.xvideos.com/videos/thumbs/0/8/7/0870cc6a3cd66f55c48e8cf241c4c268.1.jpg";
// End -->
</script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin título</title>
</head>
 
<body>
<a href="http://img100.xvideos.com/videos/thumbs/0/8/7/0870cc6a3cd66f55c48e8cf241c4c268.3.jpg" onmouseover="image1.src=loadImage1.src; image1.style.width='100%';" onmouseout="image1.src=staticImage1.src;">
<img name="image1" src="http://img100.xvideos.com/videos/thumbs/0/8/7/0870cc6a3cd66f55c48e8cf241c4c268.1.jpg" border=0></a>
</body>
</html>

No puedes acceder directamente al atributo width a partir de la imagen. A partir de la imagen puedes acceder al atributo style, y a partir de ese atributo al atributo width. Luego tienes que comentar entre comillas simples el valor del atributo width porque es una cadena de texto.

Eso son los cambios para que funcionen. Revisa el código que te he puesto.

Bonita imagen xD.

viher:
muchas gracias Franki  ;-)

:ohk<any>:
Cita de: Franki en  8 Septiembre 2010, 00:32 am


Bonita imagen xD.


 ;-) ;-) ;-)

Navegación

[0] Índice de Mensajes