Ver Mensaje Individual
  #2 (permalink)  
Antiguo 25/02/2013, 08:31
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: enviar valor de campo de texto por url... ¿Como lo hago?

Podés hacer algo más dinámico

Código HTML:
Ver original
  1. <!DOCTYPE html>
  2. <html lang="es-ar">
  3. <meta charset="utf-8" />
  4. <title>Html5</title>
  5. function envia(elemento){
  6. var valor = elemento.previousSibling.value;
  7. var el_id = elemento.previousSibling.id;
  8. window.location.href = '?valor='+ valor + '&id=' + el_id;
  9. }
  10. </head>
  11. <form action="#">
  12.     <input type="text" id="uno" value=""><input type="button" onclick="envia(this);" value="Guardar" /><br />
  13.     <input type="text" id="dos" value=""><input type="button" onclick="envia(this);" value="Guardar" /><br />
  14. </form>
  15. </body>
  16. </html>

con previousSibling identificas un elemento previo a otro, en este caso el input text anterior al boton que le sigue
Saludos
__________________
La voz de las antenas va, sustituyendo a Dios.
Cuando finalice la mutación, nueva edad media habrá
S.R.