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)
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Yes, you need to use the following javascript to do it.

function changeFrames() {
  parent.navframe.location = "YourNavFile.html";
  parent.mainframe.location = "YourMainFile.html";

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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial

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.


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.
Exploring ASP.NET Core: Fundamentals

Learn to build web apps and services, IoT apps, and mobile backends by covering the fundamentals of ASP.NET Core and  exploring the core foundations for app libraries.

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.

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?
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.
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.
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.

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

Thanks for the help.
RICHARDHAuthor Commented:

You can also take a look at
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.

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

RICHARDHAuthor Commented:
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?
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.

RICHARDHAuthor Commented:
Please post your code so I can see what you are doing or post the URL and I'll go check it out.

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...
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.
If you leave the () off the changeFrames call, it will display the function changeFrames.  Is this the problem you were having?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.