Solved

Urgent! Linking banners!

Posted on 2000-03-21
6
175 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
  • 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Find out what you should include to make the best professional email signature for your organization.
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…

864 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

23 Experts available now in Live!

Get 1:1 Help Now