SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Evangelist galt's Avatar
    Join Date
    Apr 2002
    Posts
    461
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Inter-frame communication ?

    I would like to have a page with two frames. One frame will have menu buttons, and the other frame will be a website and allow the user to move around the web. But then I want to be able to know in frame 1 what the URL is that is being displayed in frame 2 whenever the user clicks a frame1 button. Is this possible, and what technology do I need to use to do it? JavaScript maybe?

  2. #2
    ********* Genius Mike's Avatar
    Join Date
    Apr 2001
    Location
    Canada
    Posts
    5,458
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Well, this would work:

    <FORM>
    <INPUT TYPE="image" name="mybutton2" onClick="parent.frame2.location='mypage.html';
    parent.frames1.location='nav.shtml?mybutton2';">
    </FORM>

    I'm not 100% sure about the text in red, it may be parent.this or just this. I cant honestly remember

    the nav page would be .shtml so you could use ssi to incorperate the efeect you wanted

    I think thats what you were asking. feel free to clarify
    Mike
    It's not who I am underneath, but what I do that defines me.

  3. #3
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    heres an example of frames

    PHP Code:

    <form name="europe">
      <
    select name="eurselect" onChange="window.frames[0].location.href=this.options[this.selectedIndex].value" size="1" style="width:100px; font-size:11px; background-color: #ffffff;">
        <
    option value="value" selected>Select Location</option>
        <
    option value="http://www.Amsterdam.com">         Amsterdam        </option>
        <
    option value="http://www.Athens.com">         Athens            </option>
        <
    option value="http://www.Dublin.com">         Dublin            </option>
        <
    option value="http://www.Frankfurt.com">         Frankfurt        </option>
        <
    option value="http://www.Geneva[HQ].com">         Geneva [HQ]        </option>
        <
    option value="http://www.HemelHempstead[jBase].com">Hemel Hempstead [jBase]</option>
        <
    option value="http://www.London.com">         London            </option>
        <
    option value="http://www.Luxembourg.com">         Luxembourg        </option>
        <
    option value="http://www.Madrid.com">         Madrid            </option>
        <
    option value="http://www.Munich.com">         Munich            </option>
        <
    option value="http://www.Paris.com">         Paris            </option>
        <
    option value="http://www.Royston.com">         Royston        </option>
      </
    select>
    </
    form>

    <
    iframe src="http://www.google.com" id="europe" width="400" height="325" frameborder="0">

      <
    table width="400" border="0" cellspacing="0" cellpadding="0" align="center">
        <
    tr
          <
    td
            <
    div align="center"
              <
    p>
                <
    b>Your Browser does not support Inline frames.</b>
              </
    p>
              <
    p>
                <
    b>Click <a href="../testlink.htm">here</a> for an alternative version of the page you requested.</b>
              </
    p>
            </
    div>
          </
    td>
        </
    tr>
      </
    table>

    </
    iframe

  4. #4
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    sry that was an example i did for someone a while ago. It uses inline-frames, but uses the same principle.

    window.frames[0] just selects the first frame as frames holds an array of all the frames inside your page.

    http://www.webreference.com/js/column36/index.html

    that will explain a little more.


Bookmarks

Posting Permissions

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