Ver Mensaje Individual
  #8 (permalink)  
Antiguo 08/04/2011, 12:57
Avatar de Perr0
Perr0
 
Fecha de Ingreso: mayo-2005
Ubicación: Santiago de Chile, Chile
Mensajes: 676
Antigüedad: 19 años
Puntos: 79
Respuesta: Problema con una funcion

disculpe tuxceno, pero hubiera sido muy preferible que te hubieras dado un "pequeño" esfuerzo en postear...

no porque postee aquí no tengo cosas que hacer...asi que esfuerzate en redactar y escribir bien...minímo no crees.

ahora a lo tuyo......

el código de abajo no coloque id ni names, para que entiendas como funciona, tu se los puedes agregar con los arrays para recogerlos con POST o GET o como quieras...espero te sirva

Código Javascript:
Ver original
  1. <script type="text/javascript">
  2. function fncSumar(objeto,x){
  3.     if(x==1){
  4.         d=objeto;
  5.         do
  6.         objeto=objeto.nextSibling;
  7.         while(objeto.type!="text");
  8.         p=objeto;
  9.     }else if(x==-1){
  10.         p=objeto;
  11.         do
  12.         objeto=objeto.previousSibling;
  13.         while(objeto.type!="text");
  14.         d=objeto;
  15.     }
  16.     objeto=p;  
  17.     do
  18.     objeto=objeto.nextSibling;
  19.     while(objeto.tagName!="INPUT");
  20.     r=objeto;
  21.     if(!d.value || !p.value) return false;
  22.     if(isNaN(d.value) || isNaN(p.value)) {
  23.         r.value="";
  24.         return false;
  25.     }
  26.     res=d.value*p.value;
  27.     r.value=res;
  28. }
  29.  
  30. </script>

Código HTML:
Ver original
  1. <form name="f">
  2. <form name="f">
  3. <input type="text" size="15" onKeyUp="fncSumar(this,1)" />
  4. <input type="text" size="15" onKeyUp="fncSumar(this,-1)" />
  5. resultado <input type="text" size="15" readonly /><br />
  6. <input type="text" size="15" onKeyUp="fncSumar(this,1)" />
  7. <input type="text" size="15" onKeyUp="fncSumar(this,-1)" />
  8. resultado <input type="text" size="15" readonly /><br />
  9. <input type="text" size="15" onKeyUp="fncSumar(this,1)" />
  10. <input type="text" size="15" onKeyUp="fncSumar(this,-1)" />
  11. resultado <input type="text" size="15" readonly /><br />
  12. <input type="text" size="15" onKeyUp="fncSumar(this,1)" />
  13. <input type="text" size="15" onKeyUp="fncSumar(this,-1)" />
  14. resultado <input type="text" size="15" readonly /><br />
  15. <input type="text" size="15" onKeyUp="fncSumar(this,1)" />
  16. <input type="text" size="15" onKeyUp="fncSumar(this,-1)" />
  17. resultado <input type="text" size="15" readonly />
  18. </form>

salu2

NOTA: lo que dice monxas verdad, tómalo como crítica constructiva
__________________
Numerador Mp3 en Access =)
http://www.mediafire.com/download/r9...pdw/mp3(2).zip