Copy Form Data Between Frames

[Total: 0    Average: 0/5]

This example shows how to set up code to copy data between frames.

Body Code:

<BR>// for this example pretend that this form is defined 
<BR>// inside an html page call it one.html
<BR>// say we have an identical page called two.html
<BR>// lets have a frame page that defines two frames:
<BR>// one, and two
<BR>//
<BR>// when a checkbox in this file is checked it will
<BR>// copy its text box value into the other frame's
<BR>// form's textbox
<script>
function copyIt()
{
  var _form = document.one;
  if(_form.c1.checked)
  {
    parent.frames["two"].document.two.t1.value=_form.t1.value;
  }
}
</script>
<form name=one>
<input type="checkbox" name="c1" value="check me" onclick="copyIt()">
<input type=text name=t1 value="default">
</form>

Times Viewed: 2

Leave a Reply

Your email address will not be published. Required fields are marked *