Ver Mensaje Individual
  #3 (permalink)  
Antiguo 14/04/2008, 16:21
benz0
 
Fecha de Ingreso: diciembre-2002
Ubicación: Madrid
Mensajes: 378
Antigüedad: 21 años, 4 meses
Puntos: 11
Re: Problema enviando variables con espacios y tildes [GET]

Gracias por responder.
He utilizado parte del código que me has facilitado pero no se ve bien, tengo esto:

La página que envía:

Código:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin t&iacute;tulo</title>
  <script language="JavaScript">
   function abrirVentana() {
   var1 = document.formulario.nombre.value;
   var2 = document.formulario.apellido.value;
   var3 = document.formulario.edad.value;
  
   direccion = "dos.htm?var1="+var1+"&var2="+var2+"&var3="+var3;

   open(direccion,"miVentana", "toolbar=no,directories=no,menubar=no,status=no");
   }
   
  </script> 

</head>

<body>
<form name="formulario" target="ventanaForm"  method="post" >
Nombre: <input name="nombre" type="text" /><br />
Apellido: <input name="apellido" type="text" /><br />
Edad: <input name="edad" type="text" />
   <input type="button" name="boton" value="PopUp" onClick="abrirVentana()">
  </form> 
</body>
</html>
La página que recibe:

Cita:
<HTML>
<HEAD>

<script language="javascript">
CadenaVariables = location.search.substring(1,location.search.length );

Variables = CadenaVariables.split("&");

// Comenzamos a guardar las variables con sus valores
for (i = 0; i < Variables.length; i++) {
// Creamos un nuevo array, esta vez el símbolo separador será =
VariableActual = Variables[i].split("=");
// Se ejecuta solo si el valor no es un número
if (isNaN(parseFloat(VariableActual[1])))
// Devuelve el nombre y valor de la variable en formato texto
eval(VariableActual[0] + "='" + unescape(VariableActual[1]) + "';");
// Se ejecuta si es un número
else
// Devuelve el nombre y valor de la variable en formato número
eval(VariableActual[0] + "=" + VariableActual[1] + ";");
}
</script>

</HEAD>

<BODY>

Primera variable: <script language="Javascript">document.write(var1);</script><BR>
Segunda variable: <script language="Javascript">document.write(var2);</script><BR>
Tercera variable: <script language="Javascript">document.write(var3);</script><BR>
</BODY>

</HTML>
Aparece así:

Cita:
Primera variable: eduardo
Segunda variable: lópez
Tercera variable: 23

Muchas gracias.