Foros del Web » Programando para Internet » Javascript »

agrandar y achicar texto

Estas en el tema de agrandar y achicar texto en el foro de Javascript en Foros del Web. Buenas tengo un codigo en javascript funciona de lo mejor pero al momento de agrandar el texto se encima si alguien me podria ayudar aqui ...
  #1 (permalink)  
Antiguo 31/03/2011, 04:46
 
Fecha de Ingreso: octubre-2010
Mensajes: 156
Antigüedad: 13 años, 6 meses
Puntos: 0
agrandar y achicar texto

Buenas tengo un codigo en javascript funciona de lo mejor pero al momento de agrandar el texto se encima si alguien me podria ayudar aqui les dejo el codigo

Código Javascript:
Ver original
  1. var newsfont = 16;
  2. function changeFont(id) {
  3.  
  4. if (document.getElementById) {
  5. document.getElementById(id).style.fontSize = newsfont+"px";
  6. } else {
  7. if (document.layers) {
  8. document.layers[id].fontSize = newsfont+"px";
  9. } else {
  10. if (document.all) {
  11. eval("document.all." + id + ".style.fontSize = \"" + newsfont + "px \"");
  12. }
  13. }
  14. }
  15.  
  16. // esto arregla scroll al utilizar layers
  17. // updateHeight();
  18. setCookie();
  19. }
  20. // aqui se produce el error
  21. function larger() {
  22. if (newsfont < 20) {
  23. newsfont= newsfont +1;
  24. changeFont('content');
  25. }
  26. }
  27.  
  28. function smaller() {
  29. if (newsfont > 10) {
  30. newsfont= newsfont -1;
  31. changeFont('content');
  32. }
  33. }
  34.  
  35. <a onmousedown='larger()' href='javascript:void(0);'><img src='images/textogrande.gif'' alt='Aumentar texto' title='Aumentar texto' border='0'></a>
  36. <a onmousedown='smaller()' href='javascript:void(0);'><img src='images/textopeque.gif'' alt='Disminuir texto' title='Disminuir texto' border='0'></a>
  37.  
  38. <div id="noticia">Este texto se agranda y se achica</div>

Gracias!
__________________
..
  #2 (permalink)  
Antiguo 04/04/2011, 05:22
 
Fecha de Ingreso: octubre-2010
Mensajes: 156
Antigüedad: 13 años, 6 meses
Puntos: 0
Respuesta: agrandar y achicar texto

Alguien me podria ayudar con esto? o me podria ayudar con otro codigo??
__________________
..

Etiquetas: agrandar
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 21:56.