SitePoint Sponsor

User Tag List

Results 1 to 21 of 21
  1. #1
    SitePoint Zealot zbing's Avatar
    Join Date
    Jun 2002
    Location
    Lisbon, Portugal
    Posts
    159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy Loading two frames at once!

    i'm trying to load 2 html docs into 2 frames with one link

    the frames are called mainf Frame and right Frame

    my link is this:
    Code:
    <a href="home.eng.htm" target="rightFrame" onClick="parent.mainFrame.location='main.home.eng.htm'">
    and it work as expected and loads the html docs into their frames.

    the thing is that it doesn't work in IE 5 for Macintosh.

    Does anyone now why and how can i solve this?

    thnx in advance
    Last edited by zbing; Aug 13, 2003 at 09:20.
    zbing

  2. #2
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    try this reference instead

    parent.frames['mainFrame'].location.href="main.home.eng.htm"
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  3. #3
    SitePoint Zealot zbing's Avatar
    Join Date
    Jun 2002
    Location
    Lisbon, Portugal
    Posts
    159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    didn't work either, but thnx for yer help m8!
    zbing

  4. #4
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Maybe try changing onClick to onclick??

    does it give any kind of error?
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  5. #5
    SitePoint Zealot zbing's Avatar
    Join Date
    Jun 2002
    Location
    Lisbon, Portugal
    Posts
    159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it works perfectly on pc with both changes you suggested but still doesn't work in the IE 5 macintosh.

    it loads the "rightFrame" and doesnt load the "mainFrame" on the mac and no error response
    zbing

  6. #6
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I found this on PPK's site
    So this is the inconsistency: When executing a cross-frame image swap from a page that's in a different directory than the target page, Netscape requires an image path relative to the calling page while Explorer requires an image path relative to the target page.
    Maybe this applies to setting the href as well?

    That guy has some of the best info out there.
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  7. #7
    SitePoint Zealot zbing's Avatar
    Join Date
    Jun 2002
    Location
    Lisbon, Portugal
    Posts
    159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    actually i had allready read that and tried giving it the relative paths like:

    Code:
    <a href="./home.eng.htm" target="rightFrame" onClick="
    Code:
    parent.frames['mainFrame'].location.href="./main.home.eng.htm""
    zbing

  8. #8
    SitePoint Zealot zbing's Avatar
    Join Date
    Jun 2002
    Location
    Lisbon, Portugal
    Posts
    159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    both documents are in the same folder so there should be no problem finding them. Could it be that since the frameset instructs the browser to load its default pages ex.
    Code:
     
    <frameset rows="*" cols="480,*" framespacing="0" frameborder="NO" border="0">
      <frame src="main.home.pt.htm" name="mainFrame" scrolling="NO" noresize title="mainFrame">
      <frame src="home.pt.htm" name="rightFrame" scrolling="AUTO" noresize title="rightFrame">
    </frameset>
    that somehow this information is being read again and stops the onClick event to load the frame it should?
    zbing

  9. #9
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, then I'm quite certian I have no clue how to fix it

    Sorry!

    P.S. If I was in your shoes, I'd dissect this piece by piece to discover the error. Just start simple and add stuff as you go

    1) onClick="alert('hi');" make sure onclick is working
    2) onClick="alert(parent.frames['mainFrame']);" check frame reference
    3) onClick="alert(parent.frames['mainFrame'].location.href);" check href property

    You can break it down further, but I think you get the idea. If it still fails after all this w/no errors, then I suggest you get a chair, some rope, and look for a sturdy beam
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  10. #10
    I'll take mine raw silver trophy MikeFoster's Avatar
    Join Date
    Dec 2002
    Location
    Alabama, USA
    Posts
    2,560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    curiouser and curiouser...

    here's a little something else to try:

    onclick="parent.mainFrame.location='main.home.eng.htm';return true;"

    *edit*

    oops, didn't see beetle's last post. He's got the right idea there - break it down as simple as possible and go step by step.
    Last edited by MikeFoster; Aug 13, 2003 at 11:50.

  11. #11
    SitePoint Zealot zbing's Avatar
    Join Date
    Jun 2002
    Location
    Lisbon, Portugal
    Posts
    159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well...

    1. the onClick event work fine in both platforms.
    2. on the second check suggested by beetle i get and "[object]" response on the PC and a [object Window] on the mac. Actually not shure what it means :P
    3. This one responds with the URL: of the page its on eg. http://www.foo.net/site/main.home.pt.htm# on the PC and the same on the mac but without the "#"

    fortunatelly theres a bridge close to where i live just need to get that rope :|
    zbing

  12. #12
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmm, it all seems to work.So it's either a pathing issue (try giving an absolute URL, http:// and all) or (possibly?) location.href is readonly for IE-Mac?

    Aside: frames and certain operations are restricted - this security is built-in to the browser but shouldn't effect pages within the same domain. Maybe IE-Mac gets this wrong?
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  13. #13
    SitePoint Zealot zbing's Avatar
    Join Date
    Jun 2002
    Location
    Lisbon, Portugal
    Posts
    159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    actually just though of this... what if i change the frameset to 3 frames mainFrame, leftFrame, rightFrame. Then hide mainFrame by giving its a width of 0 so that only the left and right frames are visible.

    and then try the same thing but loading the stuff to leftFrame?

    I'll try it and let you now how i did...
    zbing

  14. #14
    SitePoint Zealot zbing's Avatar
    Join Date
    Jun 2002
    Location
    Lisbon, Portugal
    Posts
    159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    nope... no show!

    do you think a garden hose will do? i can't find a rope right now...
    zbing

  15. #15
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Got a link to your page online? I'd like to inspect it [img]images/smilies/biggrin.gif[/img]

    A garden hose should work just fine
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  16. #16
    SitePoint Zealot zbing's Avatar
    Join Date
    Jun 2002
    Location
    Lisbon, Portugal
    Posts
    159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    shure here it is:
    http://www.bio-logik.net/cieds/

    hope it helps
    zbing

  17. #17
    SitePoint Zealot zbing's Avatar
    Join Date
    Jun 2002
    Location
    Lisbon, Portugal
    Posts
    159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    got an idea.

    instad of using the onClick event in the main.home.pt.htm document to change it to its english version (main.home.eng.htm|mainFrame) and load the other frame's english page (home.eng.htm|rightFrame).

    i used and onLoad event in the home.pt.htm to load the correct doc (main.home.pt.htm) instead. So now as it loads it will load the mainFrame with the proper document.
    i just used an onLoad on the home.pt.htm to load the main.home.pt.htm instead and so on to every other doc.

    and it works just fine (apart from a little delay loading the mainFrame, but that could be because i have a really old/slow mac).

    thnx so much for your help beetle and mike

    cheers
    zbing

  18. #18
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Great idea zbing -- in fact, I'm embarrased to say, I used to do exactly that all the time when working on framed sites -- it's just been so long since I've worked with frames that I forgot!

    Glad you got it working!
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  19. #19
    SitePoint Enthusiast hutchysk8er's Avatar
    Join Date
    Apr 2003
    Location
    Scotland
    Posts
    61
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    this has been asked before by me, put this code in the head of ur document
    Code:
    <SCRIPT LANGUAGE="JavaScript">
    <!-- Begin
    function loadFrames(frame1,page1,frame2,page2) {
    eval("parent."+frame1+".location='"+page1+"'");
    eval("parent."+frame2+".location='"+page2+"'");
    }
    // End --> 
    </script>
    and this for the link
    Code:
    <a href="javascript:loadFrames('rightFrame', 'home.eng.htm', 'mainFrame', 'main.home.eng.htm')"> blah </a>
    hope this is what you want.
    Hutchy

  20. #20
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No no no no no! Please, don't use eval() or javascript: links!

    zbing's current solution is far better. And to replace eval() in that function

    parent.frames[frame1].location.href=""page1;
    parent.frames[frame2].location.href=""page2;
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  21. #21
    SitePoint Zealot zbing's Avatar
    Join Date
    Jun 2002
    Location
    Lisbon, Portugal
    Posts
    159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    the jobs finished and delivered but thnx for yer input anyway hutchysk8er
    zbing


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
  •