JavaScript, and Frames

I understand that you can use Javascript to direct certain documents to be loaded into specific frames, with the click of a link.
This is what I know:
function load_frame()
{  window.topFrame.location.href="first.htm";

Then in your link you write:
<A HREF="javascript:load_frame();">Link</A>

Now this will load "first.htm" into the frame titled topFrame, and "second.htm" into the frame titled middleFrame.
ok? Here is the problem.

Do you put it in the main "top" page which contains the framesets? Or do you put it in the acual frame that the link is in, or do you put it in the frames that are being effected? I have tried all of the above and it didn't work.
Please help????

Just to decrease on replys I will include the main top frameset page's html.


<TITLE>kellyCode >> HOME</TITLE>

      <FRAME SRC="grey.htm" NAME="up" SCROLLING="NO">
            <FRAMESET COLS="10%,500,*" FRAMEBORDER="0" BORDER="0">
                  <FRAME SRC="grey.htm" NAME="left" SCROLLING="auto">
                  <FRAMESET ROWS="85,*" FRAMEBORDER="0" BORDER="0">
                        <FRAME SRC="lable.htm" NAME="lable" SCROLLING="no">
                        <FRAMESET COLS="8%,*" FRAMEBORDER="0" BORDER="0">
                              <FRAME SRC="black.htm" NAME="innerleft" SCROLLING="no">
                              <FRAME SRC="intro.htm" NAME="comment" SCROLLING="auto">
                  <FRAME SRC="grey.htm" NAME="right" SCROLLING="no">
      <FRAME SRC="grey.htm" NAME="bottum" SCROLLING="no">

This site uses FRAMES, you should enable your browser
to accept frames, if you can't <a href="intro.htm">HERE</a>

Now I want a link in the frame named "innerLeft" to change the content of frames "lable, and comment". How do I do this?????
*bands head against wall* :(
link to mess <>
Thanks in advance......

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.

You should place the code in the frame that contains the link which uses the load_frame() function...
If you want to use it in a link, a better way to do this is as follows:

<a href="javascript:;" onclick="load_frame(); return false;">If you click this link two frames will change</a>

Let's try once more....

place this simple function in your innerleft frame.

<script language="javascript">
function ChangeLocation()



Then, add or change the link you want in that frame to something like this:


<A href="javascript:;" onclick="ChangeLocation();return false;">Click me to change the comment and lable frame</a>


Short explanation.
"javascript:" indicates that a javascript function must be loaded. In this case, there is no function following the javascript: statement except for ;. If you want the innerleft frame to change content as well, replace this part with your link. In the onclick, the function ChangeLocation() is followed by return false. This'll make sure the href part won't be followed. If you need the innerleft frame to change as well, remove the return false statement.

Hope this'll help you out.


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
booleanBillAuthor Commented:
Now,I only wish I knew a way to make the "back" button update ALL the frames that were changed. : )
Thanks Again!!
You're welcome.

I think you would need to store the URL for each frame just before you use the script to change the frame locations.

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

From novice to tech pro — start learning today.