Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Urgent! Linking banners!

Posted on 2000-03-21
6
Medium Priority
?
184 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 200 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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

Industry Leaders: 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!

Question has a verified solution.

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

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

618 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