Changing src of a frame of a frameset within another frameset?

Discussion in 'Javascript' started by Julius Mong, May 10, 2004.

  1. Julius Mong

    Julius Mong Guest

    Dear all, I have the following:

    <html>
    <head>
    ....
    </head>
    <frameset ...>
    <frame .../>
    <frameset name="page" rows="60,*" ...>
    <frame src='top.html' .../>
    <frameset name="main" cols="125,95%,200" ... onload="setRes(); return
    true">
    <frame name='left' .../>
    <frame name='center' src='page.html' .../>
    <frame name='right' ... />
    </frameset>
    </frameset>
    <frame src='blank_right.html' .../>
    </frameset>
    </html>

    and am trying to set the frame "center" to point to a resolution specific
    html doc to display using the following code placed in the <head> in the
    html.

    <script language="JavaScript"><!--
    function setRes() {
    if (screen.width<800) {
    top.page.main.center.location="page640.html";
    } else if (screen.width<1024) {
    top.page.main.center.location="page800.html";
    } else if (screen.width<1280) {
    top.page.main.center.location="page1024.html";
    } else if (screen.width<1600) {
    top.page.main.center.location="page1280.html";
    } else if (screen.width==1600) {
    top.page.main.center.location="page1600.html";
    }
    }
    //--> </script>

    However, I can't get it to set the frame src location by doing
    top.page.main.center.location, I have named the framesets and frames but I
    just can't get it to work... any ideas? I have tried using javascript to
    resize things on the page.html but it works very slow and my page needs to
    be refreshed very often when in action so that's why I think i'd rather have
    them in res-specific files. I presume PHP can't detect screen res right?

    Please enlighten.

    Thanks, Julius
     
    Julius Mong, May 10, 2004
    #1
    1. Advertisements

  2. Julius Mong

    Randy Webb Guest

    screen.width, for me, gives 2048, so your site would become unusable to
    me, before it ever got opened. And the fact that my browser is less than
    800 pixels wide doesn't help your case much. Or do you propose to
    attempt to make my browser 2048 pixels wide, and only 768 pixels high?

    http://www.jibbering.com/faq/#FAQ4_9

    When you get it "fixed" with regards to the resolution, you will be
    wondering what happens when I resize my browser to larger/smaller than
    the specs you chose for me (Or do you propose to attempt to stop that
    also? You can't).

    No, PHP (or any other server side language) can't determine screen
    resolution. But screen resolution is irrelevant to begin with.

    top.frames['center'].location.href =
    "somePageWithIrrelevantResolutionAspects.html";

    would be a start.
     
    Randy Webb, May 10, 2004
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.