View Full Version : Send variables from frame to frame.

05-13-2009, 07:53 AM
Hello I use dreamweaver mx html editor to make web sites. I think I know enough Html to get by. My new site uses a frame set so the head and controller don't change reload or move. This works nice, now all I have to do to make a new page is make the content page. But my problem is if I send out a link for someone to look at, it only loads the content page and not the frame set. I thought I could use javascript to determine if the frame set is present and if not load it. But I can't seem to find a way to sent variables from one frame to another. Also if a user clicks a link I would like my flash controller to reflect it. Please help!
This is my frame set:

<script language="JavaScript">
var frmst="yes";
var bodyurl="//home.htm"
<frameset rows="182,*" cols="*" framespacing="0" frameborder="NO" border="0" bordercolor="#FFFFFF" id="body">
<frame src="head.htm" name="topFrame" scrolling="NO" noresize >
<frameset rows="*" cols="180,*" framespacing="0" frameborder="NO" border="0" bordercolor="#FFFFFF">
<frame src="controle.htm" name="leftFrame" scrolling="yes" noresize>
<frame src="body.htm" name="mainFrame">


This is my body witch loads the content page:


<body bgcolor="#00FF33" link="#000000" vlink="#666666">
<script type="text/javascript">
var frmst
if(frmst!="yes"){var bodyurl="//thirdnfourteenth.com"}

Old Pedant
05-13-2009, 08:04 AM
Not clear to me why you need to "send variables" between frames to accomplish what you have stated you need.

But in any case it's not hard. The only trick is making sure that both frames are fully loaded before you attempt this.

One way to do this is to invoke a function in the other frame, *AFTER* making sure the function exists there. (If not, use setTimeout to wait a quarter second and try again.)

And you could, for example, call a function in the leftFrame from code in the mainFrame by simply doing

var valueFromOtherFrame = parent.leftFrame.someFunction( );

As for having an <A> anchor reload the entire frameset instead of a single frame, just use

<a target="_top" href="whatever.html">

_top is a special target that means the topmost frame level.