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. Advertising

  2. Julius Mong

    Randy Webb Guest

    Julius Mong wrote:
    > 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>


    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).


    > 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.


    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
    Chance Favors The Prepared Mind
    comp.lang.javascript FAQ - http://jibbering.com/faq/
     
    Randy Webb, May 10, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Steve Richter

    <txt src= ...> equivalent of <img src= ...>

    Steve Richter, Feb 8, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    2,103
    Laurent Bugnion
    Feb 9, 2006
  2. Greg Johnson
    Replies:
    4
    Views:
    3,083
  3. Replies:
    1
    Views:
    1,626
    Alex Hunsley
    Mar 23, 2007
  4. Reply Via Newsgroup

    Can I write to another window/frame that has no 'src'

    Reply Via Newsgroup, Apr 5, 2004, in forum: Javascript
    Replies:
    5
    Views:
    126
    Lasse Reichstein Nielsen
    Apr 5, 2004
  5. Simon

    frameset within frameset

    Simon, Mar 19, 2007, in forum: Javascript
    Replies:
    4
    Views:
    104
    Richard Cornford
    Mar 20, 2007
Loading...

Share This Page