By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,717 Members | 1,233 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,717 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Jul 23 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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/
Jul 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.