Solved

MULTIPLE FRAMES

Posted on 1998-02-02
17
162 Views
Last Modified: 2013-12-25
Is it possible to update the information in two separate frames by clicking on a button (Link) in one of the two frames. (i.e. I need to change the navigation frame and the main information at the same time)
0
Comment
Question by:RICHARDH
  • 8
  • 5
  • 3
  • +1
17 Comments
 
LVL 6

Accepted Solution

by:
tecbuilder earned 20 total points
ID: 1856954
Yes, you need to use the following javascript to do it.

<SCRIPT LANGUAGE="JavaScript">
<!--
function changeFrames() {
  parent.navframe.location = "YourNavFile.html";
  parent.mainframe.location = "YourMainFile.html";
}
//-->
</SCRIPT>

Then your link would have to look something like:

<a href="#" onClick="changeFrames">Change Both Frames</a>

You would of course replace my 'Change Both Frames' text to either an image and/or your own text.  However, the coding for the anchor would remain the same.  You can also use any other events such as onMouseover and onMouseout as well still if you wanted to.
0
 
LVL 3

Expert Comment

by:bigelos
ID: 1856955
bigelos,

There's a question that I answered in the HTML section that shows just that. (I think it's still locked.) take a look and let me know if that's what you had in mind.

-jello
0
 
LVL 1

Expert Comment

by:jello
ID: 1856956
bigelos,

Curious, were suggesting this:

<a href="#" onClick="parent.navframe.location = 'YourNavFile.html'; parent.mainframe.location = 'YourMainFile.html'">Click on Me</a>

This is still javascript.  The only difference is that the code is inserted into the tag instead of a function.  But this is another method to do the same thing.  If the user disables javascript neither method will work.

If on the otherhand you have a different way to do this, I am interested as well, because I have not seen any other way to do it.
0
 
LVL 6

Expert Comment

by:tecbuilder
ID: 1856957
jello, yep that would work.  Basically all you did is load a new page with frames that point to the pages you want.  I guess I never really thought of that method to update both frames on a page.  It's simple and effective.
0
 
LVL 6

Expert Comment

by:tecbuilder
ID: 1856958
jello,

What, did you copy that off my intranet page?  Just kidding, but what you suggested is what I had to do for the people at my company who insisted on keeping javascript turned off on their browsers.  So, Richard, take your pick--do you want to support javascript, or do you want to have multiple pages?
0
 
LVL 3

Expert Comment

by:bigelos
ID: 1856959
It is definitely something I never would have thought of so Richard if you don't want a Javascript solution then please reject my answer so that bigelos can answer and receive the deserved points.

I am always learning.
0
 
LVL 6

Expert Comment

by:tecbuilder
ID: 1856960
Ditto the learning.  That is what I like best about this site--you can always learn something new.  Go for the points tecbuilder.  I'm in this just for the mental workout.  Interesting that we haven't heard from Richard yet, though.
0
 
LVL 3

Expert Comment

by:bigelos
ID: 1856961
I would say that I have learned more in the last several months reading questions and answers and investingating answers for questions than I have in a year on my own reading manuals, etc.  For me it's like a search and destroy mission.  I go in search of the answer and destroy the question.  It's a mental high.
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 6

Expert Comment

by:tecbuilder
ID: 1856962
bigelos

Yes Please.. Could I have your solution which only uses the HTML rather than javascript.

Thanks for the help.
0
 

Author Comment

by:RICHARDH
ID: 1856963
Richard,

You can also take a look at http://www.experts-exchange.com/topics/bin/ShowQ?qid=8630035875
for Jello's answer.

The key HTML is
<A HREF="dif_Frame_holder.html" TARGET="_top">Click Here</A>

What you essentially need to do is link to another page that has frames in it.  This "other" page is what updates "both sides" of your frames  (You can also go from a 2-frame page to a 3-frame, etc.).  You can get really fancy and have this "other" page created on the fly by a cgi script, but that might be more work than what it is worth.

Don't make the mistake of using TARGET="_TOP" instead of TARGET="_top", because the former will create a new page, whereas the later will update the current page.
0
 
LVL 3

Expert Comment

by:bigelos
ID: 1856964
tecbuilder..

In your original javascript solution, what did the # character represent. I have tried using the # literally but this does not work

Thanks....Richard
0
 

Author Comment

by:RICHARDH
ID: 1856965
Netscape requires something be referenced to the href event in order to make the anchor work.  The # is just a default placeholder that will do nothing when the link is clicked on.

What do you mean by using the # literally?
0
 
LVL 6

Expert Comment

by:tecbuilder
ID: 1856966
By using the # literally, I mean that I entered this actual character into the script, however this caused the routine not to work. When I replaced the # with the name of our new navigation page, it worked. Please could you explain the reason for having either the # or whatever code should replace it.

Thanks
Richard
0
 

Author Comment

by:RICHARDH
ID: 1856967
Please post your code so I can see what you are doing or post the URL and I'll go check it out.
0
 
LVL 6

Expert Comment

by:tecbuilder
ID: 1856968
tecbuilder,

Instead of saying
<a href="#" onClick="changeFrames">Change Both Frames</a>

You can also do
<a href="javaScript:changeFrames()">Change Both Frames</a>

No confusion about the # here...
0
 
LVL 3

Expert Comment

by:bigelos
ID: 1856969
I agree, but I have had problems with href="javascript:...".  For some reason it doesn't always work as expected.  So I know always use href="#" onclick="..." to do the work.  It has never failed me.
0
 
LVL 6

Expert Comment

by:tecbuilder
ID: 1856970
If you leave the () off the changeFrames call, it will display the function changeFrames.  Is this the problem you were having?
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

Problem to be resolved in this article Currently, development of website and web application can be done without writing thousands of lines of programming code by hand. Description This can be done through by using a open source framework such …
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…

929 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

15 Experts available now in Live!

Get 1:1 Help Now