Foros del Web » Programando para Internet » Javascript »

Agrandar texto

Estas en el tema de Agrandar texto en el foro de Javascript en Foros del Web. Lo que necesito es que al posicionarme sobre un link (onmouseover) me agrande el texto y al salir (onmouseout) vuelva a la normalidad. <div id="grande" ...
  #1 (permalink)  
Antiguo 05/09/2008, 10:29
 
Fecha de Ingreso: octubre-2005
Mensajes: 405
Antigüedad: 18 años, 6 meses
Puntos: 1
Agrandar texto

Lo que necesito es que al posicionarme sobre un link (onmouseover) me agrande el texto y al salir (onmouseout) vuelva a la normalidad.


<div id="grande" onmouseover="agrandar('grande','','fontSize','14', 'DIV')"><a href="#">texto</a></div>

function agrandar(objId,x,theProp,theValue) { //v9.0
var obj = null; with (document){ if (getElementById)
obj = getElementById(objId); }
if (obj){
if (theValue == true || theValue == false)
eval("obj.style."+theProp+"="+theValue);
else eval("obj.style."+theProp+"='"+theValue+"'");
}
}

pero no funciona alguien me podria ayudar
  #2 (permalink)  
Antiguo 05/09/2008, 10:33
Avatar de David
Moderador
 
Fecha de Ingreso: abril-2005
Ubicación: In this planet
Mensajes: 15.720
Antigüedad: 19 años
Puntos: 839
Exclamación Respuesta: Agrandar texto

Yo lo probé y sí funciona . Lo único que te falta es hacer que vuelva a la normalidad con el onmouseout.
__________________
Por favor, antes de preguntar, revisa la Guía para realizar preguntas.
  #3 (permalink)  
Antiguo 05/09/2008, 11:20
 
Fecha de Ingreso: octubre-2005
Mensajes: 405
Antigüedad: 18 años, 6 meses
Puntos: 1
Respuesta: Agrandar texto

Tienes razon funciona solo me faltaba 14px

Ahora podria hacer referencia a un estilo (style) donde vaya tamaño, tipo letra y color, y haga lo mismo agrandar y achicar con onmouseover y onmouseout
¿Se podra?


Cita:
Iniciado por David el Grande Ver Mensaje
Yo lo probé y sí funciona . Lo único que te falta es hacer que vuelva a la normalidad con el onmouseout.
  #4 (permalink)  
Antiguo 05/09/2008, 11:22
Avatar de David
Moderador
 
Fecha de Ingreso: abril-2005
Ubicación: In this planet
Mensajes: 15.720
Antigüedad: 19 años
Puntos: 839
De acuerdo Respuesta: Agrandar texto

Si, solo necesitas cambiarle el className:
Código PHP:
objeto.className "estiloCSS"
__________________
Por favor, antes de preguntar, revisa la Guía para realizar preguntas.
  #5 (permalink)  
Antiguo 05/09/2008, 11:34
 
Fecha de Ingreso: octubre-2005
Mensajes: 405
Antigüedad: 18 años, 6 meses
Puntos: 1
Respuesta: Agrandar texto

Disculpa, no entendi donde debo realizar el cambio.

<div id="grande" onmouseover="agrandar('grande','','fontSize','14px ', 'DIV')" onmouseout="achicar('grande','','fontSize','10px', 'DIV')"><a href="#">texto</a></div>

function agrandar(objId,x,theProp,theValue) { //v9.0
var obj = null; with (document){ if (getElementById)
obj = getElementById(objId); }
if (obj){
if (theValue == true || theValue == false)
eval("obj.style."+theProp+"="+theValue);
else eval("obj.style."+theProp+"='"+theValue+"'");
}
}
function achicar(objId,x,theProp,theValue) { //v9.0
var obj = null; with (document){ if (getElementById)
obj = getElementById(objId); }
if (obj){
if (theValue == true || theValue == false)
eval("obj.style."+theProp+"="+theValue);
else eval("obj.style."+theProp+"='"+theValue+"'");
}
}

Cita:
Iniciado por David el Grande Ver Mensaje
Si, solo necesitas cambiarle el className:
Código PHP:
objeto.className "estiloCSS"
  #6 (permalink)  
Antiguo 05/09/2008, 11:39
Avatar de David
Moderador
 
Fecha de Ingreso: abril-2005
Ubicación: In this planet
Mensajes: 15.720
Antigüedad: 19 años
Puntos: 839
Exclamación Respuesta: Agrandar texto

Ese código no lo necesitas si vas a hacer referencia a una clase del CSS .
__________________
Por favor, antes de preguntar, revisa la Guía para realizar preguntas.
  #7 (permalink)  
Antiguo 05/09/2008, 11:42
 
Fecha de Ingreso: octubre-2005
Mensajes: 405
Antigüedad: 18 años, 6 meses
Puntos: 1
Respuesta: Agrandar texto

Ok. ya entendi, gracias.

Cita:
Iniciado por David el Grande Ver Mensaje
Ese código no lo necesitas si vas a hacer referencia a una clase del CSS .
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 19:58.