Foros del Web » Programando para Internet » Javascript »

unir 2 javascript en un formulario

Estas en el tema de unir 2 javascript en un formulario en el foro de Javascript en Foros del Web. buenas tardes, tengo dos js que me gustaria analizar para unirlos en un formulario este es el primero: ----------------------------------- <script> // Declare the form field ...
  #1 (permalink)  
Antiguo 20/09/2011, 14:44
 
Fecha de Ingreso: septiembre-2011
Mensajes: 1
Antigüedad: 12 años, 7 meses
Puntos: 0
Pregunta unir 2 javascript en un formulario

buenas tardes, tengo dos js que me gustaria analizar para unirlos en un formulario
este es el primero:
-----------------------------------
<script>
// Declare the form field count javascript variable so you know how many the user have added.
//The CGI.REQUEST_METHOD bit is the CF code for setting this variable back to the count where it was last up to.
var tFormFieldCount = 1;
var tFormFieldList = "";

// Function to dynamically insert the form field to the cell below. If you want textareas or other form elements, just create another function and change the html insert text below.
function MakeOne(FieldType) {
// Depending on what type of form fields the user choose then dynamically write the appropriate form element to the page
if (FieldType == 'TextInput') {
document.getElementById('DynamicContent').innerHTM L += 'Form Element ' + tFormFieldCount + '- Text input box&nbsp;&nbsp;<input type="text" name="TextInput' + tFormFieldCount + '"><br>';
} else if (FieldType == 'Textarea') {
document.getElementById('DynamicContent').innerHTM L += 'Form Element ' + tFormFieldCount + '- Textarea&nbsp;&nbsp;<textarea name="Textarea' + tFormFieldCount + '" cols=30 rows=3></textarea><br>';
}

// Populate the form element list.
if (tFormFieldList == "") {
tFormFieldList = FieldType;
} else {
tFormFieldList += "," + FieldType;
}

document.forms[0].FormFieldCount.value = tFormFieldCount;
document.forms[0].FormFieldList.value = tFormFieldList;
tFormFieldCount++;
}

// Just a function to check if the user have added any text input fields.
function CheckIt() {
if (tFormFieldCount == 1) {
alert('You must add at least one text input field.');
return false;
}
return true;
}
</script>
----------------------------------------------------------------
lo que hace es insertar tantas textarea como el usuario necesite...+
este es el segundo:
----------------------------------------------------------------
<script language="JavaScript">

function enviar(){
//document.frm2.submit();
alert("Documento enviado");
history.back();
}

function regresar(){
//document.frm2.submit();
history.back();
}

function confirma(){
var sNmb;
sNmb = document.frm.nmb.value;
sApe = document.frm.ape.value;
sPrf = document.frm.prf.value;
sApo = document.frm.apo.value;
with (document){
open();
write("<html><head>");
write(" </head><body><form name='frm2'>");
write(" <center><br><br><br><table border='0'>");
write(" <tr>");
write(" <td>");
write(" Nombre:");
write(" </td>");
write(" <td width='50' align='right'>");
write(sNmb);
write(" </td>");
write(" </tr>");
write(" <tr>");
write(" <td>");
write(" Apellido:");
write(" </td>");
write(" <td align='right'>");
write(sApe);
write(" </td>");
write(" </tr>");
write(" <tr>");
write(" <td>");
write(" Profesión:");
write(" </td>");
write(" <td align='right'>");
write(sPrf);
write(" </td>");
write(" </tr>");
write(" <tr>");
write(" </td>");
write(" </tr>");
write(" <tr>");
write(" <td>");
write(" apodo:");
write(" </td>");
write(" <td align='right'>");
write(sApo);
write(" </td>");
write(" </tr>");
write(" <tr>");
write(" <td colspan='2' align='center'>");
write(" <input type='submit' onclick='JavaScript:alert(" + '"' + "Documento enviado" + '"' + ");history.back()' value='Enviar estos valores'>");
write(" <input type='button' onclick='JavaScript:history.back()' value='Volver sin enviar'>");
write(" </td>");
write(" </tr>");
write(" </table>");
write("</form></body></html>");
close();
}
}

</script>
------------------------------------------------------------
que abre una vista de impresion de un formulario.
ahora bien, queiro juntarlas para armar una form que agregue tantos campos como el usuario necesite y les envie a la vista de impresion... alguna ayudilla porfavor??

Etiquetas: campos, formulario, html, js
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 17:47.