Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-13-2009, 06:53 AM   PM User | #1
ABE
New to the CF scene

 
Join Date: May 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
ABE is an unknown quantity at this point
Send variables from frame to frame.

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:
Code:
</head>
<script language="JavaScript">
var frmst="yes";
var bodyurl="//home.htm"
</script>
<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">
  </frameset>
</frameset>
<noframes><body>

</body>
This is my body witch loads the content page:
Code:
</head>

<body bgcolor="#00FF33" link="#000000" vlink="#666666">
<script type="text/javascript">
var frmst
if(frmst!="yes"){var bodyurl="//thirdnfourteenth.com"}
window.location=bodyurl
</script>
</body>
</html>
ABE is offline   Reply With Quote
Old 05-13-2009, 07:04 AM   PM User | #2
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,244
Thanks: 59
Thanked 3,998 Times in 3,967 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
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
Code:
var valueFromOtherFrame = parent.leftFrame.someFunction( );
As for having an <A> anchor reload the entire frameset instead of a single frame, just use
Code:
<a target="_top" href="whatever.html">
_top is a special target that means the topmost frame level.
Old Pedant is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:27 PM.


Advertisement
Log in to turn off these ads.