Solved

Add an additional frame w/o losing documents

Posted on 1998-07-23
50
342 Views
Last Modified: 2012-05-04
Does anyone know of a way to add another frame to an existing frameset once a button or link is clicked on and keep the present documents that the user has navigated to?  In other words, I have a Table of Contents on the left side, and a user has navigated to a specific place on my web site.  Let's say he wants to order something, so he clicks on a link "Order".  When it is clicked, a small frame is added across the bottom of the screen with the ordering information to be filled out (via scrolling).  I do not want open another window and definetely need to add the bottom frame.  I do not want to add it in advance so as not to take up much needed screen space for product presentation.  Any help would be appreciated.
0
Comment
Question by:kmartin7
  • 18
  • 17
  • 8
  • +3
50 Comments
 
LVL 11

Author Comment

by:kmartin7
Comment Utility
Adjusted points to 350
0
 
LVL 75

Expert Comment

by:Michel Plungjan
Comment Utility
Assuming the original frameset looks like this
<FRAMESET COLS="10%,*">
<FRAME NAME="buttonbar" SRC="bbar.htm">
<FRAME NAME="main" SRC="main.htm">
</FRAMESET>

and you want it to look like
<FRAMESET COLS="10%,*">
   <FRAME NAME="buttonbar" SRC="bbar.htm">
   <FRAMESET ROWS="90%,*">
      <FRAME NAME="main" SRC="order.htm">
      <FRAME NAME="info" SRC="orderinfo.htm">
   </FRAMESET>
</FRAMESET>

the easiest way to do it is to load a new frameset into main with the information on which page it was looking for.

If you code the pagename in the search part of the URL you can extract it:

<FORM><INPUT TYPE="BUTTON" VALUE="Order" ONCLICK="main.location='orderframes.html?' + main.location.href"></FORM>

then the orderframes.html would contain
<HTML>
<HEAD>
<SCRIPT>
function initpages() {
   var originalUrl = self.location.search.substr(1); // ignore ?
   main.location = originalUrl
}
</SCRIPT>
</HEAD>
<FRAMESET ROWS="90%,*" ONLOAD="initpages()">
   <FRAME NAME="main" SRC="javascript:' '">
   <FRAME NAME="info" SRC="orderinfo.htm">
</FRAMESET>
</HTML>

Hope this gives you the idea

Michel
0
 
LVL 75

Expert Comment

by:Michel Plungjan
Comment Utility
I am reposting this since EE whent down before I could see if I had answered it....

Assuming the original frameset looks like this
<FRAMESET COLS="10%,*">
<FRAME NAME="buttonbar" SRC="bbar.htm">
<FRAME NAME="main" SRC="main.htm">
</FRAMESET>

and you want it to look like
<FRAMESET COLS="10%,*">
   <FRAME NAME="buttonbar" SRC="bbar.htm">
   <FRAMESET ROWS="90%,*">
      <FRAME NAME="main" SRC="order.htm">
      <FRAME NAME="info" SRC="orderinfo.htm">
   </FRAMESET>
</FRAMESET>

the easiest way to do it is to load a new frameset into main with the information on which page it was looking for.

If you code the pagename in the search part of the URL you can extract it:

<FORM><INPUT TYPE="BUTTON" VALUE="Order" ONCLICK="main.location='orderframes.html?' + main.location.href"></FORM>

then the orderframes.html would contain
<HTML>
<HEAD>
<SCRIPT>
function initpages() {
   var originalUrl = self.location.search.substr(1); // ignore ?
   main.location = originalUrl
}
</SCRIPT>
</HEAD>
<FRAMESET ROWS="90%,*" ONLOA
0
 
LVL 75

Expert Comment

by:Michel Plungjan
Comment Utility
I am reposting this since EE went down before I could see if I had answered it....

Assuming the original frameset looks like this
<FRAMESET COLS="10%,*">
<FRAME NAME="buttonbar" SRC="bbar.htm">
<FRAME NAME="main" SRC="main.htm">
</FRAMESET>

and you want it to look like
<FRAMESET COLS="10%,*">
   <FRAME NAME="buttonbar" SRC="bbar.htm">
   <FRAMESET ROWS="90%,*">
      <FRAME NAME="main" SRC="order.htm">
      <FRAME NAME="info" SRC="orderinfo.htm">
   </FRAMESET>
</FRAMESET>

the easiest way to do it is to load a new frameset into main with the information on which page it was looking for.

If you code the pagename in the search part of the URL you can extract it:

<FORM><INPUT TYPE="BUTTON" VALUE="Order" ONCLICK="main.location='orderframes.html?' + main.location.href"></FORM>

then the orderframes.html would contain
<HTML>
<HEAD>
<SCRIPT>
function initpages() {
   var originalUrl = self.location.search.substr(1); // ignore ?
   main.location = originalUrl
}
</SCRIPT>
</HEAD>
<FRAMESET ROWS="90%,*" ONLOAD="initpages()">
   <FRAME NAME="main" SRC="javascript:' '">
   <FRAME NAME="info" SRC="orderinfo.htm">
</FRAMESET>
</HTML>

Hope this gives you the idea

Michel
0
 
LVL 75

Expert Comment

by:Michel Plungjan
Comment Utility
I am reposting this since EE went down before I could see if I had answered it....

Assuming the original frameset looks like this
<FRAMESET COLS="10%,*">
<FRAME NAME="buttonbar" SRC="bbar.htm">
<FRAME NAME="main" SRC="main.htm">
</FRAMESET>

and you want it to look like
<FRAMESET COLS="10%,*">
   <FRAME NAME="buttonbar" SRC="bbar.htm">
   <FRAMESET ROWS="90%,*">
      <FRAME NAME="main" SRC="order.htm">
      <FRAME NAME="info" SRC="orderinfo.htm">
   </FRAMESET>
</FRAMESET>

the easiest way to do it is to load a new frameset into main with the information on which page it was looking for.

If you code the pagename in the search part of the URL you can extract it:

<FORM><INPUT TYPE="BUTTON" VALUE="Order" ONCLICK="main.location='orderframes.html?' + main.location.href"></FORM>

then the orderframes.html would contain
<HTML>
<HEAD>
<SCRIPT>
function initpages() {
   var originalUrl = self.location.search.substr(1); // ignore ?
   main.location = originalUrl
}
</SCRIPT>
</HEAD>
<FRAMESET ROWS="90%,*" ONLOAD="initpages()">
   <FRAME NAME="main" SRC="javascript:' '">
   <FRAME NAME="info" SRC="orderinfo.htm">
</FRAMESET>
</HTML>

Hope this gives you the idea

Michel
0
 
LVL 8

Expert Comment

by:jbirk
Comment Utility
I have a question about this solution (as I am interested in solving this as well).  When using target="framename" for links, will the new main replace the older main, or will links (say on the buttonbar) which say target="main" refresh the right side removing the ordering frame, or would it load it into the main frame which is intended (i.e. keeping the order frame)?

-Josh
0
 
LVL 8

Expert Comment

by:jbirk
Comment Utility
I have a question about this solution (as I am interested in solving this as well).  When using target="framename" for links, will the new main replace the older main, or will links (say on the buttonbar) which say target="main" refresh the right side removing the ordering frame, or would it load it into the main frame which is intended (i.e. keeping the order frame)?

-Josh
0
 
LVL 75

Expert Comment

by:Michel Plungjan
Comment Utility
Firstly I apologise for all the extra comments - I posted the answer but could seemingly not access EE after that - it looks now like I DID access it each time.

Whether the new main replaces the old main will probably depend on the browser. I would not be one bit surprised if the new main had to be accessed as top.main.main.

The more I look at my suggestion, the more I am convinced a new name would be safer - so main was the frame with single frame and main2 or such would be the name of the new upper part of the dual frames.

I find that each time I use nested framesets, the complexity of the scripts multiply - with names such as parent.parent.framename.

The basic suggestion of using the seach property of the URL remains a good solution when one needs to keep the loaded page - it is also a good way to reload the frameset when a page inside the frames has been bookmarked.

Michel
PS: I will ask custome service to get rid of the extra comments.
0
 
LVL 11

Author Comment

by:kmartin7
Comment Utility
Michel,

I get Javacript error "main is not defined".  I can't figure out why.  It is occurring at the ONCLICK="main.location='orderframes.html?' portion of bbar.htm.  Any ideas?  
0
 
LVL 6

Expert Comment

by:Holger101497
Comment Utility
Michel: My guess would also be top.main.main *g* - the question is what happens when clicking this link <a href="somepage.html" TAGRET="MAIN"> ?? I'd guess it replaces the right side completely... I agree that a new name would make things a lot clearer.

kmartin: replace "main" with "parent.main" since main is not a subframe of buttonbar, it's a "sibling" *g*
0
 
LVL 11

Author Comment

by:kmartin7
Comment Utility
I added parent, now I get: "parent.main.location is read-only" ??? What is this?  I have never seen this before.  
0
 
LVL 11

Author Comment

by:kmartin7
Comment Utility
I added parent, now I get: "parent.main.location is read-only" ??? What is this?  I have never seen this before.  
0
 
LVL 2

Expert Comment

by:Quixote
Comment Utility
I have mocked up a demo for you of just his sort of thing.

http://www.lamancha.org/demos/kmartin7/index.html


Here is essentially what you put on every page that you think they will be on when they decide to activate the order form.  It assumes that activating the order form is done from the page you need to preserve.


<html>
<head>
   <title>Magically Reloading Order Form!</title>

<script>
<!-- conceal

if (location.search)
   {
   var Here = self.location.href.substring(0,self.location.href.indexOf('?'));
   
   var Frameset = '<frameset rows="80%,20%">' +
                  '  <frame src="' + Here + '">' +
                  '  <frame src="Order.html">' +
                  '</frameset><noframes>';
   
   document.write(Frameset)
   }

// reveal -->
</script>

</head>
<body>

<a href="javascript:self.location.search='?Order'">Order</a><BR>
<a href="javascript:parent.location.href=self.location.href">Remove Order Form</a>

</body>
</noframes>
</html>


The script detects if there exists a search string, which would only exist if they clicked the Order link below.  If there is a search string, then the page creates a frameset with the order form and itself as the pages.  Removing the order form can also be done in HTML (and much more stably, I might add) if you just target the name of the frame this page has been loaded into.  I just didn't have your frameset, so I couldn't tell you what to do there.

If this gets you most the way but not all the way, let me know and I will spruce it up to your specs.
0
 
LVL 6

Expert Comment

by:Holger101497
Comment Utility
Are you using Internet-Exploder?
In that case, you probably have to write parent.main.location.href='whatever.html'; (either way should work fine in Netscape - unless the frames are from diferent doamins in which case you might run into more serious problems ("security" issues))
0
 
LVL 75

Expert Comment

by:Michel Plungjan
Comment Utility
KMartin7: Sorry for any errors you have encountered, I intended to show the technique you could use so I wrote it off the top of my head and I sometimes forget to specify the parent or top when working with subframes.

I apologise for assuming, you could fix any inconsistencies yourself. A comment would have been sufficient to let me know you had problems with my code. If you show your frames, I think we can get it to work with some minor modifications. Evaluate Quixotes answer and let me know...

Holger: Thank for clarifying...

Quixote: I would appreciate if you did not just take the already suggested technique, fix any minor bugs and repost as an answer...

Michel
0
 
LVL 2

Expert Comment

by:Quixote
Comment Utility
Aw, crap.  Sorry Michel.  You'll have to trust me on this:  when I was writing my suggestion I had intended on submitting it as an answer, but then later figured that even with the vast differences in employing our techniques (yours involves a second document to contain the frameset which then forwards you to the document, mine is about the page carrying its own customized frameset within), that the techniques are similar enough that I changed my mind and meant to submit it as a comment.  I'm still kinda new around here and I guess I forgot the simple click I needed to do and I haven't checked back until now.  I am sorry about that.  In general, is there a way to change an answer you have submitted to be listed as a comment instead?

KMartin7-  Even if you find my technique useful, PLEASE REJECT MY ANSWER.  It should have been submitted as a comment so that the group could generate ideas based on it and test it out and whatnot.  I apologize for this inconvenience.


That said (and in an effort to make this comment have a little content related to the discussion), one distinct advantage of my technique is that each time the frameset is generated, it loads exactly the documents needed the first time instead of loading and then forwarding which can cause an unwanted "flash" of the dummy page.  One drawback is that this code needs to be on every page, and so cannot be cached (unless you put it in an external .js file referenced in the src= attribute, but that would exclude Netscape 2 users and who wants that?).

  I used a similar technique in answering Q.10066308 if you would like to read more about how this technique works.
0
 
LVL 75

Expert Comment

by:Michel Plungjan
Comment Utility
Quixote, That is ok... The main technique I suggested is coding the page in the search or hash of the url, not the creation of the frames.

Carrying the frameset with you in the subpages is a neat idea that I will have to try out one day but I would be afraid of the following:

1. Mirror effect - one mistake and the page will load itself as a frameset within the frameset within....

2. Complexity - although my off the top of my head attempt had problems with the ancestry, once it is fixed, it is simpler and therefore more robust - it is always risky to write the major tags (body, frameset, form) with javascript

3. Compatability - I would dread debugging your example since MSIE would just throw up some error without the possibility of seeing where it occurred.

Let us see what is preferred.

Michel
0
 
LVL 2

Expert Comment

by:Quixote
Comment Utility
Michel brings up very valid points about the solution I suggested.  I have tested this technique in all the browsers I could get ahold of (Mac/Win95/WinNT, NN2/3/4, IE3/4, and Opera), but that doesn't mean it's going to work for future version (although it should -- it uses very basic javascript that should never be deprecated).

The biggest problem I've had with this techique is the infinitely reloading page, as Michel points out.  Be sure you do not change this line:

var Here = self.location.href.substring(0,self.location.href.indexOf('?'));

as that is what shaves off the search string and therefore causes the reload to only happen once.  If you don't recognize the importance of this line, it's easy to mistakenly change -- and that would be bad.
0
 
LVL 75

Expert Comment

by:Michel Plungjan
Comment Utility
The demo you put on you site does not work at all in my 16 bit version of netscape 3.03 for windows 3.x at least not with entry at KMartin7/index.html

I get two links, one order and one remove order and when clicked I get textual representation of the links
?Order on screen with javascript:self.location.search='?Order'
and
http://www.lamancha.org/demos/kmartin7/index.html on screen with
javascript:parent.location.href=self.location.href

It should work but doesn't

Only if I load the url http://www.lamancha.org/demos/kmartin7/index.html?Order do I get two frames...

Michel

0
 
LVL 2

Expert Comment

by:Quixote
Comment Utility
This is an unfortunate development.  As noted in my list of successful tests, I couldn't test on a Win16 browser of any type.  The code in the demo was written in the hopes that something universal could be made, so the code wouldn't have to be changed on a page-per-page basis.  And here's the failing of that.

I have changed the demo to reflect this by hard-coding the links as plain href's instead of javascript.  Note, however, that the "remove order form" link is still targetting the parent, and so this target should be replaced by the name of the frame this page appears in.

Thanks for the pointer, Michel.
0
 
LVL 11

Author Comment

by:kmartin7
Comment Utility
Michel,

I did make the mistake of reopening the question to others.  I will post some sample code later tonight (7/27). I thought is could figure it out, but the "read-only" error threw me for a loop.

P.S.  Target broswer is Communicator.

Quixote,

I have over 3,000 possible pages, and that number is increasing more everyday.  I realize that I could use something like X-Replace to add this script onto evry page, but that may still corrupt some of the HTML code - scary.

Kurt
0
 
LVL 10

Expert Comment

by:MasseyM
Comment Utility
I didn't read everything that had been written so far, so this could be a repeat... but,Why not create the frame you want, just set the width or height to 0.  then when the link is clicked, use JavaScript to resize the frame and load the doc into that frame...

- Matt
0
 
LVL 2

Expert Comment

by:Quixote
Comment Utility
MasseyM - Javascript cannot resize frames.  Your answer will not work as stated.

kmartin -- if your target browser is only Communicator and you don't need to be compatible with Netscape 2 or 3, or Explorer 3, then that changes everything:  I would now suggest placing a hidden layer on every document, written and dynamically adjusted using a Javascript src= file so that the information can be cached separate from the page.  I don't know enough DHTML to code this for you: I still believe code should be compatible with browsers you seem to be ruling out, so I haven't bothered myself with Layer and all that.  Find someone who has.  I'm sure this'll work.
0
 
LVL 75

Expert Comment

by:Michel Plungjan
Comment Utility
KMartin, I look forward to the code and I still believe my solution (when error free <g>) would be the simplest and easiest to implement since there is no testing of what the page might be.

It seems I have some time tomorrow (Tuesday) so I will try to create a working demo from your example html (and if not then make what I cobbled together earlier work)... Sorry to have thrown you - not intended.

Quixote: I do not believe in DHTML for such things - it is still too browser dependant and a pain if the boss suddenly says, "Oh by the way we forgot to tell you: It needs to run in MSIE 3 on Macintosh too"

Michel

0
 
LVL 11

Author Comment

by:kmartin7
Comment Utility
Michel,

I'm sorry, I said that I would post sample code last night, but I got tied up with my 3 year-old son ( playing ;-).

I thought that I missed something (and therefore thought I corrected the problem) but upon further review, I still get the "read-only" error.

It would be easier for me to e-mail you the code via a zip file.  My e-mail is kmartin7@oklahoma.net.  If you would please be so kind as to e-mail me, I will reply with the information.  If I have time tonight, I will post the code for you on E-E.

Matt:

I thought of this idea earlier, but the powers-that-be do not want to confuse our audience (Postal Service).  Some people will obviously notice this, and tons of comments about what the "empty frame" is for will soon follow.

Sorry.

Kurt




0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 11

Author Comment

by:kmartin7
Comment Utility
Adjusted points to 500
0
 
LVL 11

Author Comment

by:kmartin7
Comment Utility
Michel,

The frameset below is my main frameset:

<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; iso-8859-1">
<TITLE>TOC Frameset</TITLE>
</HEAD>
<FRAMESET ROWS="6%,*,6%">
      <FRAME SRC="../toc/ovrl.htm" NAME="ovrl">
            <FRAMESET COLS="20%,*">
                  <FRAME SRC="../toc/toc.htm" NAME="toc">
                  <FRAME SRC="index.htm" NAME="text">
            </FRAMESET>
      <FRAME SRC="data.htm" NAME="data">
      </FRAMESET>
</HTML>

This is what I want to achieve:

<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; iso-8859-1">
<TITLE>TOC Frameset</TITLE>
</HEAD>
<FRAMESET ROWS="6%,*, 6%, 6%">
      <FRAME SRC="../toc/ovrl.htm" NAME="ovrl">
            <FRAMESET COLS="20%,*">
                  <FRAME SRC="../toc/toc.htm" NAME="toc">
                  <FRAME SRC="index.htm" NAME="text">
            </FRAMESET>
      <FRAME SRC="data.htm" NAME="data">
      <FRAME SRC="../../orderparts.htm" NAME="order">
</FRAMESET>
</HTML>

This way, when a user decides he needs to order a part, the bottom frame will apppear and keep the user's present place in the document, no matter where he is at.  It is imperative that it be configures this way - otherwise we are taking up too much of the screen with superfluous frames that may never be needed.

Interesting, I get home and try the script (verbatim according to what you posted) and I don't get the error (using NN 4.5 at home versus 4.05 at work).  But it still does not work.  Nothing appears at all - nothing changes.

I have increased the points to 500.  They are your for the taking...

Kurt
0
 
LVL 2

Expert Comment

by:Quixote
Comment Utility
Kurt-

A while before you mentioned "Target browser is Communicator."

Is this going to be the only browser hitting the site?  Are you in an intranet setting?  If so, as much as I avoid it in everyday programming (for all the reasons Michel points out), your solution really should be some DHTML layers and stuff.  Not only will it appear on cue, but it can disappear just as readily, and take up any size chunk of real-estate you want, unlike a frame which is limited to being a row or column.

Let us know what browsers we need to be compatible with -- the answer may be as easy as swiping the code from Web Monkey's javascript archive.
0
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 600 total points
Comment Utility
The scripts in Frameset 1 and two are identical.

The only difference between them is the extra frame

Because you wanted the space taken from the middle instead of taking it from the existing frame 3 I had to do it this way.

Please note there is some extra code to remove the file:// protocol so it can be tested from harddisk. When you are happy, it can be removed....

Hope this answers your question in full - if not, please comment on what does not work the way you need...

The links to turn order frame on and off are

<BR><A HREF="javascript:top.whatframeset(0);">Load Data page alone</A>
<BR><A HREF="javascript:top.whatframeset(1);">Load datapage and OrderFrame</A>


<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; iso-8859-1">
<TITLE>Frameset 1 without order frame</TITLE>
<SCRIPT LANGUAGE="JavaScript"><!-- // hide
function whatframeset(order) {
   var Loc = '../pages/'; //  where are the framesets stored

   var PageName = top.frames[3].location.href; // What page is currently in the data frame

   // The following is only necessary if you wish not to change the script in each frameset.
   if (order) Loc += 'fset2.htm?';
   else       Loc += 'fset1.htm?';

   // We will get errors if the file protocol is used (can be ignored on a web server)
   PageName = PageName.toLowerCase();
   if (PageName.indexOf('file:') !=-1) PageName = PageName.substring(7);
   // end of file protocol handling

   Loc += PageName
   alert(Loc);
   top.location = Loc;
}

function loadframe() {
   alert(self.location.search.substring(1));
   if (self.location.search) top.frames[3].location = self.location.search.substring(1);
}
// end hide --></SCRIPT>
</HEAD>
<FRAMESET ROWS="6%,*,6%" ONLOAD="top.loadframe()">
   <FRAME SRC="../toc/ovrl.htm" NAME="ovrl">
   <FRAMESET COLS="20%,*">
      <FRAME SRC="../toc/toc.htm" NAME="toc">
      <FRAME SRC="index.htm" NAME="text">
   </FRAMESET>
   <FRAME SRC="data.htm" NAME="data">
</FRAMESET>
</HTML>



<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; iso-8859-1">
<TITLE>Frameset 2 with order frame</TITLE>
<SCRIPT LANGUAGE="JavaScript"><!-- // hide
function whatframeset(order) {
   var Loc = '../pages/'
   var PageName = top.frames[3].location.href; // What page is currently im the frame

   // The following is only necessary if you wish not to change the script in each frameset.
   if (order) Loc += 'fset2.htm?';
   else       Loc += 'fset1.htm?';

   // We will get errors if the file protocol is used (can be ignored on a web server)
   PageName = PageName.toLowerCase();
   if (PageName.indexOf('file:') !=-1) PageName = PageName.substring(7);
   // end of file protocol handling

   Loc += PageName
   top.location = Loc;
}

function loadframe() {
   if (self.location.search) top.frames[3].location = self.location.search.substring(1);
}
// end hide --></SCRIPT>
</HEAD>
<FRAMESET ROWS="6%,*, 6%, 6%" ONLOAD="top.loadframe()">  
   <FRAME SRC="../toc/ovrl.htm" NAME="ovrl">
   <FRAMESET COLS="20%,*">
      <FRAME SRC="../toc/toc.htm" NAME="toc">
      <FRAME SRC="index.htm" NAME="text">
   </FRAMESET>
   <FRAME NAME="data" SRC="javascript:' '">
   <FRAME SRC="../../orderp.htm" NAME="order">
</FRAMESET>
</HTML>


Hope this nails it down
Michel

0
 
LVL 75

Expert Comment

by:Michel Plungjan
Comment Utility
PS: I left in two alerts in one of the scripts, they can of course also be removed if you wish.

Be advised that cutting and pasting from EE somtimes introduces funny characters - if you have problems, give me an email address and I will send the pages to you...

Netscape 4.5 - Is it nice? I will not dl it at home on 14K4 so I will have to wait until I get back to work and a 512K line...


0
 
LVL 11

Author Comment

by:kmartin7
Comment Utility
Quixote-

Our target browser is NC4, but we can't be sure that 50k users will all use this browser - at least for a while.  Go ahead and post your ideas.  The thing that turned me away from your idea was including a script on each page - something I really do not want to do (to all our possible pages.

Kurt
0
 
LVL 11

Author Comment

by:kmartin7
Comment Utility
Michel-

I will try this tonight at home (I am in training all week and have no time to test at work).

As far as NN 4.5, It isn't too much different from 4.0x. The e-mail access is much quicker, and it has some "neat" added items such as "My Netscape" and a way to access "Related sites" (?), which is something that allows the web site creator to add other links from a button on the Navigation Toolbar.  I really only used for the first time last night, so I don't know all the "ins and outs" yet.

Thanks,

Kurt
kmartin7@oklahoma.net
0
 
LVL 8

Expert Comment

by:jbirk
Comment Utility
NN 4.5?? How do you get that?  I went to netscape's site and was not able to find a 4.5 available for download.  Just 4.05
-Josh
0
 
LVL 11

Author Comment

by:kmartin7
Comment Utility
0
 
LVL 8

Expert Comment

by:jbirk
Comment Utility
Thanks!  (This page is getting rather long isn't it?)
0
 
LVL 11

Author Comment

by:kmartin7
Comment Utility
Michel:

1. I cut and paste the anchor tags (javascript:top.whatframeset(0)&(1))into my ovrl.htm document.

2. I created two new documents with the 2 different framesets in them.  I called one fset1.htm and the other fset2.htm. I then placed them into a directory called "pages".

I loaded the page, the second frame comes up, but i cannot return t to the original frameset using the other link.  I think it has something to do with the "var Loc = '/pages/'" variable.  I think it would work if this variable did not exist. I can get around this (I think).

The other problem is that whenever the fset2.htm comes up, I lose whatever is in the frame named "text', and an alert comes up that says that it cannot find the file or directory named "pages/index.htm".  I cannot figure this part out.  

I did make the pages directory a subdirectory, but I corrected the script from var Loc = '../pages/' to var Loc = '/pages/', so I don't think this would cause it.

Any suggestions?

Kurt

email: kmartin7@oklahoma.net

0
 
LVL 2

Expert Comment

by:Quixote
Comment Utility
you said:

" I did make the pages directory a subdirectory, but I corrected the script from var Loc = '../pages/' to var Loc = '/pages/', so I don't think this would cause it. "

This is one of your problems.  In Unix parlance, "../pages" means start at this directory, go up one directory, and look for the directory named "pages".  Now, "/pages" in Unix means start at the root of this server and look for the direcory named "pages", which is not what you want.

Change
var Loc = '/pages/';
to
var Loc = './pages/';
or even
var Loc = 'pages/';

That should help you out.

In regard to my non-frames solution - heck, I sure could use 600 points, but I don't know DHTML.  I stay away from it cuz it only works on version 4 browsers.  But if you want to see what I mean, point your Netscape 4 browser to http://www.webmonkey.com and take a look at that nav panel that slides out from the left.  Now, imagine that sliding over and containing your order form.  That's what I am figuring you could use.  And get this:  Web Monkey has even provided you with a tutorial on how to make that very nav bar:

http://www.hotwired.com/webmonkey/97/45/index1a.html?tw=dynamic_html

Hope that helps you out!
0
 
LVL 75

Expert Comment

by:Michel Plungjan
Comment Utility
KMartin: I am sorry if it is difficult to implement - the pages directory and that variable was to make it possible to use your directory structure which dictates that the toc is in a parallel directory, and orderparts.htm is two directories higher.

Please put fset1 and fset2 where the original framesets were in your example and remove the pages variable like this:
  var Loc = '../pages/'; //  where are the framesets stored
change it to
  var Loc = '';

I expected index.htm to always be in the frame named text since you only wanted to add the frame where the frame named data was...
This is not a huge problem but it does make the url rather long...

Please change the scripts in each fset to the following

<SCRIPT LANGUAGE="JavaScript"><!-- // hide
function whatframeset(order) {
   var Loc = '';
   var PageName = '';

   // The following is only necessary if you wish not to change the script in each frameset.
   if (order) Loc += 'fset2.htm?';
   else       Loc += 'fset1.htm?';

   /* The following could be made to loop through all frames, and store each.
      The URL could also be made shorter if a base url was subtracted
      (like get rid of http://www.server.com/)
      The pages are separated with comma.
   */
   PageName +=       protocolCheck(top.frames[2].location.href); // frame 2
   PageName += ',' + protocolCheck(top.frames[3].location.href); // frame 3

   Loc += PageName
   top.location = Loc;
}

function loadframe() {
   if (self.location.search) {
      FLocs = self.location.search.substring(1);
      if (FLocs.split) var spl = FLocs.split(',');
      else var spl = parent.mySplit(FLocs,','); // use a compatible split
      top.frames[2].location = spl[0]; // also here we could loop through all frames
      top.frames[3].location = spl[1]; // but KISS.
   }
}

function protocolCheck(PageName) {
   // We will get errors if the file protocol is used (can be ignored on a web server)
   var TestPage = PageName.toLowerCase(); // keep case in original
   if (TestPage.indexOf('file:') !=-1) PageName = PageName.substring(7);
   return PageName;
}

function mySplit(S,Delim) {
   var i = 0;
   var p = 0;
   var oldp = 0;
   var spl = new Array();

   while (S.indexOf(Delim,oldp) > 0 ) {
      p = S.indexOf(Delim,oldp);    // find the delimiter
      spl[i] = S.substring(oldp,p); // from after old delimiter to delimiter
      oldp = p + 1;
      i++
   }
   if (p<S.length) spl[i] = S.substring(p+1);
   return spl;
}
// end hide --></SCRIPT>

Please tell me it works<g> I am off to Paris and will not read my email until Tuesday

Michel
0
 
LVL 11

Author Comment

by:kmartin7
Comment Utility
Michel:

It works great!  Thanks for all of your hard work.  Enjoy Paris!

Kurt

Quixote:

I checked out webmonkey several months back and already tested something similar to their expand/collapse navigation.  I also checked out Netscape's.  I am familiar with DHTML, and for some reason, it didn't click that using it was what you wanted me to try.  In fact, their are two types of navigation used on these handbooks - one with a table of contents and the other is a "Visual" type of navigation, where you navigate by moving the mouse over the area of the machine of interest, and using layers, a pop-up menu appears with links to all the information related to that specific area (i.e. removal and replacement, alignments and adjustments, theory of operation, parts information, etc.)  It really is a great "product", and with Michel's help (and everyone else involved), it is getting better.

Thanks again everyone,
Kurt
0
 
LVL 2

Expert Comment

by:Quixote
Comment Utility
Sounds really neat.  Is there a url where we can see it?
0
 
LVL 11

Author Comment

by:kmartin7
Comment Utility
Unfortunately, it is on the Postal intranet.  It will also be available via CD-ROM.
0
 
LVL 75

Expert Comment

by:Michel Plungjan
Comment Utility
I am so glad it worked!

I have the same problem - most of my best scripts are on an intranet...

If you ever feel like sending me the CD ;-)

Michel

PS: We really enjoyed Disneyland (Nicole is 4 1/2)

0
 
LVL 11

Author Comment

by:kmartin7
Comment Utility
Michel,

I finally got everything up on the web server, and now I get the error "top.location is read only". I simply do not understand why this happens. Target browser is NN4.  I checked it on IE4, and there is no problem.  Any help?  I will gladly give you 100 points for the help.

Kurt
0
 
LVL 75

Expert Comment

by:Michel Plungjan
Comment Utility
Funny you should get that - I JUST got the same message from somewhere else.

It seems that top.location is read only if self == top and only in NN 4(.05?)
Without looking at your page I hope that this is the case.
If yes, use location instead or top.location
If no, please show me the code as you have implemented it

Michel
0
 
LVL 11

Author Comment

by:kmartin7
Comment Utility
Here it is again:
<HTML>
    <HEAD>
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; iso-8859-1">
    <TITLE>DocSoft Coporation Visual Navigation Demonstration</TITLE>
   

      <SCRIPT LANGUAGE="JavaScript"><!-- // hide
      function whatframeset(order) {
         var Loc = '';
         var PageName = '';

         // The following is only necessary if you wish not to change the script in each frameset.
         if (order) Loc += 'fset2.htm?';
         else       Loc += 'fset1.htm?';

         /* The following could be made to loop through all frames, and store each.
            The URL could also be made shorter if a base url was subtracted
            (like get rid of http://www.server.com/)
            The pages are separated with comma.
         */
         PageName +=       protocolCheck(top.frames[1].location.href); // frame 2
         PageName += ',' + protocolCheck(top.frames[2].location.href); // frame 3

         Loc += PageName
         location = Loc; //changed from top.location as you suggested-same problem
      }

      function loadframe() {
         if (self.location.search) {
            FLocs = self.location.search.substring(1);
            if (FLocs.split) var spl = FLocs.split(',');
            else var spl = parent.mySplit(FLocs,','); // use a compatible split
            top.frames[1].location = spl[0]; // also here we could loop through all frames
            top.frames[2].location = spl[1]; // but KISS.
         }
      }

      function protocolCheck(PageName) {
         // We will get errors if the file protocol is used (can be ignored on a web server)
         var TestPage = PageName.toLowerCase(); // keep case in original
         if (TestPage.indexOf('file:') !=-1) PageName = PageName.substring(7);
         return PageName;
      }

      function mySplit(S,Delim) {
         var i = 0;
         var p = 0;
         var oldp = 0;
         var spl = new Array();

         while (S.indexOf(Delim,oldp) > 0 ) {
            p = S.indexOf(Delim,oldp);    // find the delimiter
            spl[i] = S.substring(oldp,p); // from after old delimiter to delimiter
            oldp = p + 1;
            i++
         }
         if (p<S.length) spl[i] = S.substring(p+1);
         return spl;
      }
      // end hide --></SCRIPT>
</HEAD>
<FRAMESET ROWS="6%,*,5%,6%" ONLOAD="top.loadframe()">
      <FRAME SRC="toc.htm" NAME="toc">
        <FRAME SRC="system.htm" NAME="text">
      <FRAME NAME="data" SRC="javascript:' '">  
      <FRAME SRC="orderp.htm#A" NAME="order">      
</FRAMESET>
</HTML>

Did you go to EuroDisney?

Kurt


0
 
LVL 75

Expert Comment

by:Michel Plungjan
Comment Utility
Yes we went! It was VERY nice and Nicole loved it

I have added a test for javascript: since that is the protocol when no data page is loaded. I have put top. back in since it IS needed (badly unless you want cascading frames, not a pretty sight)

I have tested in NS 3.03 and 4.06 and it now works again. Please change the scripts and let me know:

             function whatframeset(order) {
                var Loc = '';
                var PageName = '';

                /* The following is only necessary if you wish not to change the script in each frameset. */
                if (order) Loc += 'fset2.htm?';
                else       Loc += 'fset1.htm?';

                /* The following could be made to loop through all frames, and store each.
                   The URL could also be made shorter if a base url was subtracted
                   (like get rid of http://www.server.com/)
                   The pages are separated with comma.
                */
                PageName +=       protocolCheck(top.frames[1].location.href); // frame 2
                PageName += ',' + protocolCheck(top.frames[2].location.href); // frame 3

                Loc += PageName;
                top.location = Loc; // MUST be top.location
             }

             function loadframe() {
                if (self.location.search) {
                   FLocs = self.location.search.substring(1);
                   if (FLocs.split) var spl = FLocs.split(',');
                   else var spl = parent.mySplit(FLocs,','); // use a compatible split
                   if (spl[0]) top.frames[1].location = spl[0]; /* also here we could loop through all frames but KISS. */
                   if (spl[1]) top.frames[2].location = spl[1];
                }
             }

             function protocolCheck(PageName) {
                var TestPage = PageName.toLowerCase(); /* keep case in original */

                /* If there is no data page, the protocol is javascript - return nothing  */
                if (TestPage.indexOf('javascript:') !=-1) PageName = '';
                /* We will get errors if the file protocol is used (can be ignored on a web server) */
                if (TestPage.indexOf('file:') !=-1) PageName = PageName.substring(7);
                return PageName;
             }

The rest stays the same.

Michel

0
 
LVL 11

Author Comment

by:kmartin7
Comment Utility
Again, it works with the local machine (file) protocol, but it does not work once placed on the web server.  I still get the read-only error.  
0
 
LVL 75

Expert Comment

by:Michel Plungjan
Comment Utility
Ohhhh - since you didn't mention that, I never even bothered to test it off a server.
I will get right on it!

Michel
0
 
LVL 75

Expert Comment

by:Michel Plungjan
Comment Utility
Hmmm took some work and it now works for me in NN3.03
MSIE 3.02 and NC 4.06

Hope it will for you too.

I will register a bug that if you change location with anything after the name of the html page, make sure there is a fuly qualified path in front. so
location = 'mypage.html?something'
should be
location = 'http://www.myserver.com/mypage.html?something'

Weird!

Here is the modified whatFrame script:

function whatframeset(order) {
   var h = location.href;
   var isSearch = h.indexOf('?');
   if (isSearch !=-1) h = h.substring(0,isSearch); /* cut after any question mark. Important! cascading frame alert! */
   (p=h.lastIndexOf("/")) > 0 ? homedir=h.substring(0,p+1) : homedir = ""; /* This is all one line */
   var Loc = homedir;
   var PageName = '';

   /* The following is only necessary if you wish not to change the script in each frameset. */
   if (order) Loc += 'fset2.htm?';
   else       Loc += 'fset1.htm?';

   /* The following could be made to loop through all frames, and store each.
      The URL could also be made shorter if a base url was subtracted
      (like get rid of http://www.server.com/)
      The pages are separated with comma.
   */
   PageName +=       protocolCheck(top.frames[1].location.href); // frame 2
   PageName += ',' + protocolCheck(top.frames[2].location.href); // frame 3

   Loc += PageName;
   top.location = Loc;
}

Hope it works now!

Michel

PS: Would it be a bother to shove a
/* Scripts (c) 1998 Michel Plungjan
   Comments, bugs or improvements to
   michel@irt.org */

somewhere ?

Thanks
0
 
LVL 75

Expert Comment

by:Michel Plungjan
Comment Utility
So you put the applet in the same page and combine kollegovs and my script:
function isLoaded() {
   var Done = false;
   if(document.myapplet) { // Applet there
      if(document.myapplet.ready) { // Function ready exists
         if(document.myapplet.ready==true) // and is true
            if (document.images) document.spush.src = 'http://134.103.56.13:81';
            else location = 'http://134.103.56.13:81';
            Done = true;
         }
      }

   }
   if (!Done) setTimeout(isLoaded(),3000); // wait 3 secs  
}
</SCRIPT>
<BODY onLoad="isLoaded()">
<img NAME="spush" src="icon/connect.gif" width="320" height="240">
<APPLET NAME="myapplet".....>



Michel

Michel

0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now