PDA

View Full Version : Faqlink in frames


e-myther
11-11-2002, 12:05 AM
Hi guys

I'm trying to create a glossary page & I want to have an index at the top of the page at all times.

I've made an example (http://www.painting-effects.co.uk/glossary.htm) using JavaScript to hold a form at the top of the page.

This works okay except when the user scrolls the page using a mouse-wheel.

I was wondering if I might be able to improve this by using frames, but I know virtually nothing about using frames.


Is it possible to target a faqlink in one frame from another?

&

Would I be better off using just 2 frames or using a 3rd to contain the other 2 ?


Any help would be greatly appreciated.

e-



P.S. If I've posted this in the wrong forum: please move it. (sorry)

doni
11-11-2002, 03:50 AM
Try the following.


<!--the height can be represented as a percentage of the browser window, a number of pixels, or the balance remaining.

The height specifications will be discussed below.-->

<frameset rows="heightOfTopRow,heightOfBottomRow">

<frame name="top" src="top.html">
<frame name="bottom" src="bottom">

</frameset>


Then in the navigation page:


<a href=OneOfMyLinks.html" target="bottom">This page will appear in the bottom frame</a>


height formats:

rows="150,* ;top row = 150 pixels/bottom row = remainder of browser window
rows = "20%,*" ;top row = 20 percent of browser window/bottom row = remainder of browser window
rows = "*,50%" ;bottom row = half of the browser window/top row = remainder of browser window

Hope this helps. Good luck.

Don

P.S. The frames can be nested in any combination of rows and columns you like. For tutorials on frames see this Frame Tutorial (http://www.w3schools.com/html/html_frames.asp).

One more thing: you acknowledged that this may have been the wrong board. The better one would have been the "HTML & CSS (http://www.codingforums.com/forumdisplay.php?s=&forumid=13)".

e-myther
11-12-2002, 12:29 AM
Thanks Don



That's just what I wanted & more.

Here's the new page (http://www.painting-effects.co.uk/container.htm).







You wouldn't happen to know the JavaScript code for ensuring the page is contained within the frameset would you?
Something like: if (top !='container.htm' location.replace('container.htm')) or something !?





Thanks again,
e-




P.S. When I posted my question, I looked up & down the list of forums, but I just couldn't see the word HTML.
I'll get my eyes tested tomorrow. ;-)

e-myther
11-12-2002, 08:02 PM
It doesn't matter Don, I've done it.


I twiddled with some JavaScript for a while, & this seems to work:


<script language="JavaScript"><!--
if (self == top) {
if (document.images)
top.location.replace('container.htm');
else
top.location.href = window.location.container.htm;
}
//--></script>



Thanks anywayz
e-

doni
11-13-2002, 04:03 AM
No problem--glad to be able to assist.

The page looks very nice. One more suggestion for you. Do you know that your target audience uses frames enabled browsers? If not, consider adding a "noframes" section. In that frame you could display all of the information.

If your host supports Server Side Includes (aka SSI), this would be a fairly simple matter of including the top and bottom htm pages.

I don't know the syntax for SSI, so I'll just use psuedo-code here.

<noframes>
<body>
<SSI code for "top">
<SSI code for "bottom">
</body>
</noframes>

e-myther
11-14-2002, 12:36 AM
Thanks Don

That sounds like a good idea.

My server doesn't support SSI.

I wonder if this would work:




<noframes>
<SCRIPT LANGUAGE="JavaScript">
<!--
window.location.replace("an_alternative_page.htm")
//-->
</SCRIPT>
</noframes>




But then they would have to have a java enabled browser for that to work
... & I think that it would only work for Internet explorer !



All browsers are created equal ... just differently, that's all! :confused:


e-

doni
11-14-2002, 01:32 AM
Originally posted by e-myther

But then they would have to have a java enabled browser for that to work
... & I think that it would only work for Internet explorer !



There would be NO need to use Java Script to load one page in it's place. The following code will reload an alternate page in place of the current one. <META HTTP-EQUIV="refresh" CONTENT="1; URL=AlternatePage.html"> Place it INSIDE the "Noframes" tags. If I'm not mistaken the frame definition and the no frame definition has to be in the head for this to work.
I don't think that IE is the only browser that supports JS.


P.S. part of the reason that I suggested SSI in my previous post, was that you need to display the contents of two seperate files. If you go witht his method, you'll need to maintain seperate files--one containing BOTH the definitions and the header and the one with JUST the definitions that is used in your frame.

e-myther
11-15-2002, 07:25 PM
Thanks Don :thumbsup:



I'll test the code & use it if it works. (I'm sure it will)



In my previous message; I meant that only IE understands the window.location.replace('href')
But I could be wrong about that.



Thanks again for all your help.


e-