Foros del Web » Programando para Internet » Javascript »

email

Estas en el tema de email en el foro de Javascript en Foros del Web. hola compañeros. Estoy haciendo un correo en php y ya lo tengo casi listo, pero quisiera agregar varios email que escoja el usuario a un ...
  #1 (permalink)  
Antiguo 14/10/2009, 07:37
 
Fecha de Ingreso: septiembre-2008
Mensajes: 136
Antigüedad: 15 años, 8 meses
Puntos: 1
email

hola compañeros.
Estoy haciendo un correo en php y ya lo tengo casi listo, pero quisiera agregar
varios email que escoja el usuario a un input, creo que es una funcion de javascript por eso lo coloco en este foro.
La idea es que sea mas o menos como en hotmail cuando uno escoge varios contactos para enviarles un mensaje.

Porfa alguien que me guie. gracias.
  #2 (permalink)  
Antiguo 14/10/2009, 08:44
Avatar de ceSharp  
Fecha de Ingreso: octubre-2008
Ubicación: Madrid
Mensajes: 495
Antigüedad: 15 años, 6 meses
Puntos: 66
Respuesta: email

hola mindoata,

algo así?
-------------------------------
//codigo js
function rellenaTextBox()
{
var texto = '';
var ch1 = document.getElementById('ch1');
var ch2 = document.getElementById('ch2');
var ch3 = document.getElementById('ch3');
if(ch1.checked)
texto += ch1.value + ';';
if(ch2.checked)
texto += ch2.value + ';';
if(ch3.checked)
texto += ch3.value + ';';

document.getElementById('tx_box').value = texto;
}
-------------------------
<!--html-->
<input id="ch1" onclick="rellenaTextBox();" type="checkbox" value="uno" />uno<br />
<input id="ch2" onclick="rellenaTextBox();" type="checkbox" value="dos" />dos<br />
<input id="ch3" onclick="rellenaTextBox();" type="checkbox" value="tres" />tres<br />
<input type="text" style="width:300px" id="tx_box" />
--------------------------

naturalmente (y.... obligatoriamente) se debería de mejorar este codiguillo porque siempre los pone por orden (es decir, si tienes el tres marcado y marcas el uno, te aparece primero el uno y luego el tres... un poco cutre! jejeje)
pero como tampoco sé si es esto lo que quieres no me he esmerao mucho! :)

pruébalo y a ver que te parece.

salu2
  #3 (permalink)  
Antiguo 14/10/2009, 10:06
 
Fecha de Ingreso: septiembre-2008
Mensajes: 136
Antigüedad: 15 años, 8 meses
Puntos: 1
Respuesta: email

ceSharp sera que me puedes guiar mejor es que tome tu codigo pero no funciona.

algo hace falta para que funcione ese pequeño ejemplo?
  #4 (permalink)  
Antiguo 14/10/2009, 10:17
Avatar de ceSharp  
Fecha de Ingreso: octubre-2008
Ubicación: Madrid
Mensajes: 495
Antigüedad: 15 años, 6 meses
Puntos: 66
Respuesta: email

cópiate/pégate todo esto entero en tu página (sustituyendo todo)
-----------------------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Untitled Page</title>
<script type="text/javascript">
function rellenaTextBox()
{
var texto = '';
var chán = document.getElementById('chón');
var ch2 = document.getElementById('ch2');
var ch3 = document.getElementById('ch3');
if(chán.checked)
texto += chán.value + ';';
if(ch2.checked)
texto += ch2.value + ';';
if(ch3.checked)
texto += ch3.value + ';';

document.getElementById('tx_box').value = texto;
}


</script>
</head>
<body>
<div>
<input id="chón" onclick="rellenaTextBox();" type="checkbox" value="uno" />uno<br />
<input id="ch2" onclick="rellenaTextBox();" type="checkbox" value="dos" />dos<br />
<input id="ch3" onclick="rellenaTextBox();" type="checkbox" value="tres" />tres<br />
<input type="text" style="width:300px" id="tx_box" />

</div>
</body>
</html>
-------------------------------------------
hasta aquí (esto ya no... ;)

salu2
  #5 (permalink)  
Antiguo 14/10/2009, 10:19
Avatar de ceSharp  
Fecha de Ingreso: octubre-2008
Ubicación: Madrid
Mensajes: 495
Antigüedad: 15 años, 6 meses
Puntos: 66
Respuesta: email

... hay algunas variables que tienen acento... debería de funcionar (es que estaba probando códigos con acento y se me ha colado...) si quieres por si acaso cópiate esto mejor
-------------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Untitled Page</title>
<script type="text/javascript">
function rellenaTextBox()
{
var texto = '';
var ch1 = document.getElementById('ch1');
var ch2 = document.getElementById('ch2');
var ch3 = document.getElementById('ch3');
if(ch1.checked)
texto += ch1.value + ';';
if(ch2.checked)
texto += ch2.value + ';';
if(ch3.checked)
texto += ch3.value + ';';

document.getElementById('tx_box').value = texto;
}


</script>
</head>
<body>
<div>
<input id="ch1" onclick="rellenaTextBox();" type="checkbox" value="uno" />uno<br />
<input id="ch2" onclick="rellenaTextBox();" type="checkbox" value="dos" />dos<br />
<input id="ch3" onclick="rellenaTextBox();" type="checkbox" value="tres" />tres<br />
<input type="text" style="width:300px" id="tx_box" />

</div>
</body>
</html>
------------------------------------------
  #6 (permalink)  
Antiguo 14/10/2009, 10:26
 
Fecha de Ingreso: septiembre-2008
Mensajes: 136
Antigüedad: 15 años, 8 meses
Puntos: 1
Respuesta: email

Perfecto ceSharp gracias. lo modificare.
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 10:17.