Ver Mensaje Individual
  #4 (permalink)  
Antiguo 25/08/2010, 16:06
Avatar de Adler
Adler
Colaborador
 
Fecha de Ingreso: diciembre-2006
Mensajes: 4.671
Antigüedad: 17 años, 4 meses
Puntos: 126
Respuesta: Ejecutar función cuyo nombre se le pasa como parámetro a otra función

@zerokilled se me ocurrió ¿y usando la función eval()?
Código Javascript:
Ver original
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  5. <script type="text/javascript">
  6. function b(id){
  7. alert(document.getElementById(id).value)
  8. }
  9.  
  10. function funcion(a){
  11. eval(a)(a);
  12. }
  13. </script>
  14. </head>
  15. <body>
  16. <form>
  17. <input type="checkbox" id="b" value="1" onclick="funcion(this.id);" />
  18. </form>
  19. </body>
  20. </html>
__________________
Los formularios se envían/validan con un botón Submit
<input type="submit" value="Enviar" style="background-color:#0B5795; font:bold 10px verdana; color:#FFF;" />