You are here: irt.org | FAQ | JavaScript | Form | Q1346 [ previous next ]
No. The layer is effectively a separate document in Netscape Navigator. The form element has to be wrapped up within its own <form> and </form> tags.
You can copy the data from the form in the layer to hidden form fields in the other form, by capturing the onSubmit event handler. You can also include the form elements in the tabbing by adding onblur() event handlers:
<script language="JavaScript"><!-- function copyData() { if (document.layers) { document.form2.text1.value = document.layer1.document.form1.text1.value; document.form2.text2.value = document.layer1.document.form1.text2.value; } else if (document.all) { document.form2.text1.value = document.layer1.form1.text1.value; document.form2.text2.value = document.layer1.form1.text2.value; } return false; } //--></script> <span id="layer1" style="position:relative"> <form name="form1"> 1: <input type="text" name="text1"><br> 2: <input type="text" name="text2" onBlur="if (document.layers) window.document.form2.text3.focus()"><br> </form> </span> <form name="form2" onSubmit="return copyData()"> <input type="hidden" name="text1"> <input type="hidden" name="text2"> 3: <input type="text" name="text3"><br> 4: <input type="text" name="text4" onBlur="if (document.layers) document.layer1.document.form1.text1.focus()"><br> <input type="submit"> </form>