Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    ABE
    ABE is offline
    New to the CF scene
    Join Date
    May 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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>

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,155
    Thanks
    75
    Thanked 4,338 Times in 4,304 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •