473,219 Members | 1,637 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,219 software developers and data experts.

View with or without frames - giving users the choice

Hi All!

I have a frameset document and I want each mainFrame document to have
the following ability:
- be viewed by itself (i.e. without frames if within frameset).
- be viewed within frame (i.e. put back in the frameset if not within
frameset).

I have written the following so far:

<script type="text/javascript" language="JavaScript">
<!--
function withFrames()
{
if (parent.frames.length == 0) {
parent.location.href='/RobertMarkBram/index.htm';
// parent.mainFrame.location.href=document.location.h ref;
}
} // end withFrames function
function withoutFrames()
{
if (parent.frames.length != 0) {
parent.location.href=document.location.href;
}
} // end withFrames function

document.write("<p onClick='withFrames();'>View with frames.</p>");
document.write("<p onClick='withoutFrames();'>View without
frames.</p>");

-->
</script>

My problem is to get the 'target' page loaded back into mainFrame..

You can see my attempt here:
http://phd.netcomp.monash.edu.au/Rob...osal/index.htm

Any help would be most appreciated!

Rob
:)
Jul 23 '05 #1
2 1783
In article <fa**************************@posting.google.com >,
re********@optusnet.com.au enlightened us with...
Hi All!

I have a frameset document and I want each mainFrame document to have
the following ability:
- be viewed by itself (i.e. without frames if within frameset).
- be viewed within frame (i.e. put back in the frameset if not within
frameset).

I have written the following so far:


You need a dynamic frameset.
This is best done server-side, but as long as you're already using
javascript...
This is the one I wrote that has two frames. Watch for word-wrap and put
your doc names in the sources and change the frame names and attributes
as desired. You pass the url to the frameset.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN"
"http://www.w3.org/TR/REC-html40/frameset.dtd">
<html>
<head>
<title>Test Javascript Dynamic Frameset</title>
<script language="javascript" type="text/javascript">
function loadMainFrame()
{
/* See if the url has a doc to load and load it if present.
The page to load is expected to be in the param "url" as in
http://www.servername.com/testFrames...testFrame3.htm.
If the param is absent, nothing is changed, which will keep the
default page in the mainFrame.
*/

var searchString = window.location.search.substring(1);
if (searchString == null || searchString.length == 0) return; // if
no params specified, do nothing

var pairs = searchString.split('&'); // allows more params than just
the url for extensibility
if (pairs == null) return; // if no params specified, do nothing

// pairs has the pairs of values, like url=whatever.htm, param2
=value2, param3=value3
// we split that up by the = sign into an associative array (hash)
for easy lookup
var tmp;
var paramArray = new Array();
for (var i=0; i<pairs.length; i++)
{
tmp = pairs[i].split("=");
paramArray[tmp[0]] = tmp[1];
}

// paramArray should now have values like paramArray["url"]
=whatever.htm, paramArray["param2"]=value2
if (!paramArray["url"]) return; // if no url specified, do nothing
else window.frames["mainFrame"].location.href=paramArray["url"];
return;
}
</script>
</head>

<frameset cols="110,*" onLoad="loadMainFrame()">
<frame src="testFrame1.htm" name="leftFrame">
<frame src="testFrame2.htm" name="mainFrame">
</frameset>
</html>

--
--
~kaeli~
Suicide is the most sincere form of self-criticism.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #2
Hi Kaeli,
I have a frameset document and I want each mainFrame document to have
the following ability:
- be viewed by itself (i.e. without frames if within frameset).
- be viewed within frame (i.e. put back in the frameset if not within
frameset).

I have written the following so far:


You need a dynamic frameset.
This is best done server-side, but as long as you're already using
javascript...


Thank you very much for your suggestion. I started looking for a
solution using ASP serverside singe I agree with your suggestion.. but
in the end I have decided to avoid frames altogether and use
serverside templates. But thank you again for your time - it is much
appreciated!

Rob
:)
Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Don Schneider | last post by:
I tried to setup a frameset which consists of 4 different subframes. Each of these subframes should fetch a different web page from the internet and display it completely (!). BUT: the vertical...
40
by: JohnnyCJohnny | last post by:
Is it pretty safe to say that almost all web surfers now use browsers that are Frames compatible? What are most people using these days? IE? Thanks
31
by: wallster | last post by:
please keep the flaming to a minimum (a bucket of water is next to me) but I have a question someone here might be able to explain in basic terms for a dunce like me. I helped a friend put...
2
by: Robert Stearns | last post by:
Can I construct a restricted view and grant select access on it to a user without granting select access to the underlying tables and views? This seems to be an easy way to restrict a user to just...
1
by: SteveComplex | last post by:
I'm currently working on a project developing a web application that makes heavy use of 3rd-party controls, popup windows and frames ( not my design I hasten to add ). Some of the pages make use...
0
by: Jacob Donajkowski | last post by:
Once the user logs in I want to have the users switch from the Roster View to the Profile View and enter their profile infomation and save it. Then the next time they login and go to the Profile...
7
by: rjames.clarke | last post by:
Back when frames were in vogue, we would set up the navigation or menu bar to change the content of the main frame. This had the advantage of not requiring the whole page to reload. Just the...
12
by: MartinRinehart | last post by:
They just don't get no respect. "In the early days of JavaScript, multiframe and multiwindow web applications were fairly common. Now, web design has turned strongly against the use of frames...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.