Solved

Urgent! Linking banners!

Posted on 2000-03-21
6
181 Views
Last Modified: 2010-04-09
Hello all,
   I have a page called index.htm which consists of toc.htm as the left frame and main.htm as the right frame.

toc.htm has links like Hiring, Downloads etc. These links open in my main.htm when they are clicked.
Now I have an external link from some other page to just hiring.htm

But it only opens that page not in my frame. What is the way to link to any of my pages and at the same time keep toc.htm as the frame?

Thanks,
-Hocam
0
Comment
Question by:Hocam
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 8

Expert Comment

by:jbirk
ID: 2643147
With a little javascript, you can detect when a person enters you site without the frames, and then send them to the framed version.  The using the search string in the url have the frameset change the href of a frame based on that value.

code to follow...


-Josh
0
 
LVL 8

Accepted Solution

by:
jbirk earned 50 total points
ID: 2643186
OK, here's the frameset code:
<SCRIPT language="JavaScript">
<!--
function load_frame()
{

var search = location.search;
if (search.length > 0)
 {
  search = search.substr(1); //gets rid of '?'
  var strArr= search.split('=');
  if (strArr[0] == "left")
   top.left.location=strArr[1];
  else if (strArr[0] == "right")
   top.right.location=strArr[1];
 }

}
// -->
</SCRIPT>
<!-- frames -->
<frameset  cols="50%,*" onload="load_frame();">
<frame name="left" src="left.html">
<frame name="right" src="right.html">
</frameset>


Then on the left frame pages, this code goes at the beginning of the document:
<SCRIPT language="JavaScript">
<!--
if (top.location==location)
 location='index.html?left='+location;
// -->
</SCRIPT>

and the right frame pages:

<SCRIPT language="JavaScript">
<!--
if (top.location==location)
 location='index.html?right='+location;
// -->
</SCRIPT>


Hopefully you get the idea.  Just change the names of the frames accordingly.  If there's something you don't understand, feel free to ask.

-Josh
0
 
LVL 3

Expert Comment

by:davlun20080
ID: 2643190
Syntax may be wrong, but you can place code in hiring.htm that checks to see if it is in a frameset, if not redirect to a frameset with toc and hiring in it.

<script languange="JavaScript">
<!--
   if(parent.frames.length=0)      window.top.location.replace="framesetHiring.htm";
//-->
</script>

where framesetHiring.htm is a second frameset to your site that will open with toc and hiring already open.

davlun
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Expert Comment

by:davlun20080
ID: 2643199
Josh, you beat me again.  This time by two minutes.  One of these days I'll get in on time....

As a side note, I don't understand how your script will work.  If you are following a link like www.smith.com/hiring.htm that would open the file hiring.htm on it's own, how does your script move it to the frameset.  It looks like the link he would be giving out would be to a frameset then?

davlun
0
 
LVL 8

Expert Comment

by:jbirk
ID: 2643209
If the link is to a single html page with no frameset, it loads up the frameset and tells the frameset which page to load in which frame.  This way the person also can't view the frames individually apart from the frameset.

The
location='index.html?right='+location;
command loads the frameset (named index.html here) and tells it to load the current location into the right frame, since it's supposed to be in the frame of this frameset.  This way the default right page can be overriden by the page that's wanted (perhaps even a couple levels deep into site?)

-Josh
0
 
LVL 1

Author Comment

by:Hocam
ID: 2645328
Perfect answer...!!!
I have added increased the points to 60 for you!

Thank you!
-Hocam
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

738 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