Foros del Web » Programando para Internet » Javascript »

Alguien me puede explicar?

Estas en el tema de Alguien me puede explicar? en el foro de Javascript en Foros del Web. Hola alguien me puede explicar esto : <!-- PRIMER PASO: Colocar dentro del tag HEAD --> <style type="text/css"> #im { FILTER: alpha(opacity=50) } </style> <script ...
  #1 (permalink)  
Antiguo 25/08/2002, 20:36
 
Fecha de Ingreso: agosto-2002
Mensajes: 3
Antigüedad: 21 años, 8 meses
Puntos: 0
Alguien me puede explicar?

Hola alguien me puede explicar esto :

<!-- PRIMER PASO: Colocar dentro del tag HEAD -->

<style type="text/css">
#im {
FILTER: alpha(opacity=50)
}
</style>

<script language="JavaScript1.2">
function high(which2)
{
theobject=which2;
highlighting=setInterval("highlightit(theobje ct)",50);

}
function low(which2)
{
clearInterval(highlighting);
which2.filters.alpha.opacity=50;
}
function highlightit(cur2)
{
if(cur2.filters.alpha.opacity<100)
cur2.filters.alpha.opacity+=5
else if(window.highlighting)
clearInterval(highlighting)
}
</script>

<!-- SEGUNDO PASO: Colocar dentro del tag IMG -->

<img id="im" onmouseover="high(this)" onmouseout="low(this)">

-----------------------------------------
Se supone que es un efecto para cuando pase el puntero del mouse sobre una imagen
Lo que pasa es que no le entendi al segundo paso , osea, como que ponga dentro del "tag IMG"??, alguien me puede poner un ejemplo de como debo colocarlo?? :P

Gracias!! ;)
  #2 (permalink)  
Antiguo 25/08/2002, 20:46
 
Fecha de Ingreso: diciembre-2001
Ubicación: Madrid
Mensajes: 889
Antigüedad: 22 años, 4 meses
Puntos: 4
Re: Alguien me puede explicar?

Hola buenas:
Lo que hace el script, es ponerte opacidad a la imagen que vos indicque al 50%, y que al pasar sobre ella, ésta se vaya incrementando hasta llegar a su opacidad 100%.
Para hacerlo, TAG se refiere a una directida dentro de < y >. Como bien te indica al final del script, solo te falta indicarle la dirección de la imagen:

<img src=tuimagen.jpg id="im" onmouseover="high(this)" onmouseout="low(this)">

Saludos!

<html><center><embed src="http://www.iespana.es/redmaestro/banner.swf" height=75 width=500>
</embed></center></html>
  #3 (permalink)  
Antiguo 25/08/2002, 21:00
 
Fecha de Ingreso: diciembre-2001
Ubicación: Madrid
Mensajes: 889
Antigüedad: 22 años, 4 meses
Puntos: 4
Re: Alguien me puede explicar?

Ahhh y la explicación... pues ésto es lo que debes tener en cuenta:

&lt;html&gt;
&lt;head&gt;
&lt;style type=&quot;text/css&quot;&gt;
#im {

//Opacidad que tendrá la imagen nada más ser cargada
FILTER: alpha(opacity=50)

}
&lt;/style&gt;

&lt;script language=&quot;JavaScript1.2&quot;&gt;
function high(which2)
{
theobject=which2;

//Te aconsejo no cambiar esta parte
highlighting=setInterval(&quot;highlightit(theobje ct)&quot;,50);

}
function low(which2)
{
clearInterval(highlighting);

//Opacidad que tendrá al quitar el mouse de la imagen
which2.filters.alpha.opacity=50;

}
function highlightit(cur2)
{
if(cur2.filters.alpha.opacity&lt;100)

//Velocidad con la cual volverá a su opacidad normal
cur2.filters.alpha.opacity+=5

else if(window.highlighting)
clearInterval(highlighting)
}
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;img src=imagen.jpg id=&quot;im&quot; onmouseover=&quot;high(this)&quot; onmouseout=&quot;low(this)&quot;&gt;
&lt;/body&gt;
&lt;/html&gt;

Chao!

<html><center><embed src="http://www.iespana.es/redmaestro/banner.swf" height=75 width=500>
</embed></center></html>
  #4 (permalink)  
Antiguo 25/08/2002, 21:21
 
Fecha de Ingreso: agosto-2002
Mensajes: 3
Antigüedad: 21 años, 8 meses
Puntos: 0
Re: Alguien me puede explicar?

Wow!
Que rapido contestan aqui!!

Muchas Gracias! ahora si ya le entendi :P
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 10:10.