Reference element in frameset : frameset « HTML Tags « JavaScript Tutorial






index.html

<HEAD>
</HEAD>
<FRAMESET cols="150,*">
<FRAME name="left_side" src="1.html">
<FRAME name="right_side" src="2.html">
</FRAMESET>

1.html

<HEAD>

<SCRIPT language="JavaScript">
<!--
var thename="";
var thecolor="";
var thecar="";
//-->
</SCRIPT>
</HEAD>
<BODY>
This is frame 1.
</BODY>

2.html

<HEAD>
<SCRIPT language="JavaScript">
<!--
function set_info() {
    top.left_side.thename=document.f1.t1.value;
    top.left_side.thecolor=document.f1.t2.value;
    top.left_side.thecar=document.f1.t3.value;
    self.location="3.html";
}
//-->
</SCRIPT>
</HEAD>
<BODY>
    This is frame 2.
    <P>
        <FORM name="f1">What is your name?<BR>
        <INPUT type="text" name="t1"><BR>What is your favorite color?<BR>
        <INPUT type="text" name="t2"><BR>What is your favorite car?<BR>
        <INPUT type="text" name="t3"><BR>
        <INPUT type="button" value="Continue" onClick="set_info();">
        </FORM>
</BODY>

3.html

<HEAD>
</HEAD>
<BODY>
<SCRIPT language="JavaScript">
<!--
    document.write("top.left_side.thename:"+top.left_side.thename+"top.left_side.thecolor:"+top.left_side.thecolor+"top.left_side.thecar: "+top.left_side.thecar)
//-->
</SCRIPT>
</BODY>








21.8.frameset
21.8.1.Output a frameset through document.write
21.8.2.Change frame location(URL)
21.8.3.Reference the top frame
21.8.4.Reference the parent frame
21.8.5.Nested framesets
21.8.6.Change two frames in a frame set
21.8.7.Reference element in frameset