Ver Mensaje Individual
  #4 (permalink)  
Antiguo 07/02/2012, 09:47
Avatar de emprear
emprear
Colaborador
 
Fecha de Ingreso: junio-2007
Ubicación: me mudé
Mensajes: 8.388
Antigüedad: 16 años, 10 meses
Puntos: 1567
Respuesta: innerHTMl funciona a veces

No sé bien que es lo que no te funciona
Probá asi
Código HTML:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <title>titulo</title>
  5. <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  6.  
  7. <script type="text/javascript">
  8. //<![CDATA[
  9. function cambiarTexto(texto,cajaperX){
  10. var elTexto =document.getElementById(cajaperX);
  11. var longitud = document.getElementById('textoPer').value;
  12. var elPrecio = document.getElementById('pvp');
  13.  
  14. elTexto.innerHTML = texto;
  15. if(longitud.length > 0){
  16. alert(longitud.length);
  17. elPrecio.innerHTML = "cambio el numero";
  18. }else{
  19. elPrecio.innerHTML = "25";
  20. }
  21. }
  22. //]]>
  23. </head>
  24. <form action="#">
  25. <input type="text" id="textoPer" onKeyUp="cambiarTexto(this.value,'cajaPer');"/>
  26. </from>
  27.  
  28. <div id="pvp">25</div>
  29. <div id="cajaPer"></div>
  30.  
  31. </body>
  32. </html>
Saludos
__________________
La voz de las antenas va, sustituyendo a Dios.
Cuando finalice la mutación, nueva edad media habrá
S.R.