Ver Mensaje Individual
  #4 (permalink)  
Antiguo 08/05/2012, 11:13
Avatar de emprear
emprear
Colaborador
 
Fecha de Ingreso: junio-2007
Ubicación: me mudé
Mensajes: 8.388
Antigüedad: 17 años, 8 meses
Puntos: 1567
Respuesta: Usar javascript:[funcion()] en un action de form html

Esta es otra forma de hacerlo

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. <style type="text/css">
  8. /*<![CDATA[*/
  9.  
  10. /* estilos */
  11.  
  12. form{
  13. width: 500px;
  14. height: 300px;
  15. display: block;
  16. }
  17.  
  18. #paso1, #paso2,#paso3 {
  19. width: 500px;
  20. height: 300px;
  21. border: solid 1px #000;
  22. }
  23. #paso2, #paso3{
  24. display: none;
  25. }
  26. /*]]>*/
  27. <script type="text/javascript">
  28. //<![CDATA[
  29. /* script */
  30. function paso1(){
  31. document.getElementById('paso1').style.display='block';
  32. document.getElementById('paso2').style.display='none';
  33. document.getElementById('paso3').style.display='none';
  34. }
  35. function paso2(){
  36. document.getElementById('paso1').style.display='none';
  37. document.getElementById('paso2').style.display='block';
  38. document.getElementById('paso3').style.display='none';
  39. }
  40. function paso3(){
  41. document.getElementById('paso1').style.display='none';
  42. document.getElementById('paso2').style.display='none';
  43. document.getElementById('paso3').style.display='block';
  44. }
  45.  
  46. function ver(){
  47. alert(document.getElementById('nombre').value + '-' + document.getElementById('apellido').value);
  48. }
  49.  
  50. //]]>
  51. </head>
  52. <p>
  53. <a href="#" onclick="paso1();">uno</a> | <a href="#" onclick="paso2();">dos</a> | <a href="#" onclick="paso3();">tres</a>
  54. </p>
  55. <form action="x.php" method="post">
  56. <div id="paso1">
  57. Nombre : <input type="text" name="nombre" id="nombre" />
  58. </div>
  59. <div id="paso2">
  60. Apellido: <input type="text" name="apellido" id="apellido" />
  61. </div>
  62. <div id="paso3">
  63. <input type="button" name="procesar" onclick="ver();" value="procesar"/>
  64. </div>
  65. </form>
  66. </body>
  67. </html>

Creo que es má simple, al final puse solo un button, no un submit para que verifiques que los valores siguen estando ahi, aunque cada sección se oculte, el javascript se puede abreviar un poco, pero si no son muchos pasos se puede dejar asi

Saludos
__________________
La voz de las antenas va, sustituyendo a Dios.
Cuando finalice la mutación, nueva edad media habrá
S.R.