?
Solved

JavaScript, and Frames

Posted on 1999-11-18
4
Medium Priority
?
314 Views
Last Modified: 2010-04-27
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";
     window.middleFrame.location.href="second.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.

WHERE DO YOU PUT THIS CODE???
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.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<BASE HREF="http://jodellah.virtualave.net/kellycode/">
<HTML>

<HEAD>
<TITLE>kellyCode >> HOME</TITLE>

</HEAD>
<FRAMESET ROWS="5%,*,5%" FRAMEBORDER="0" BORDER="0">
      <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">
                        </FRAMESET>
                  </FRAMESET>
                  <FRAME SRC="grey.htm" NAME="right" SCROLLING="no">
            </FRAMESET>
      <FRAME SRC="grey.htm" NAME="bottum" SCROLLING="no">
</FRAMESET>


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

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 <http://jodellah.virtualave.net/kellycode/>
Thanks in advance......



           
   
0
Comment
Question by:booleanBill
  • 3
4 Comments
 
LVL 5

Expert Comment

by:aarie
ID: 2217922
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>


Arjan.
0
 
LVL 5

Accepted Solution

by:
aarie earned 150 total points
ID: 2236706
Let's try once more....

place this simple function in your innerleft frame.

------
<script language="javascript">
function ChangeLocation()
{
 top.comment.location.href="newcommentloc.html";
top.lable.location.href="newlableloc.html";

}
</script>

-----

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.

Arjan.
0
 

Author Comment

by:booleanBill
ID: 2240582
Thanks!!
Now,I only wish I knew a way to make the "back" button update ALL the frames that were changed. : )
Thanks Again!!
0
 
LVL 5

Expert Comment

by:aarie
ID: 2244787
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.

Arjan.
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Question has a verified solution.

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

Monitor input from a computer is usually nothing special.  In this instance it prevented anyone from using the computer.  This was a preconfiguration that didn't work.
pc, laptop  monitor connection configurations
How to fix display issue, screen flickering issue when I plug in power cord to the machine. Before I start explaining the solution lets check out once the issue how it looks like after I connect the power cord. most of you also have faced this…
The video provides a quick and easy steps to migrate MBOX file to well known Outlook PST and Office 365. Besides this, it also supports and migrates more than 20 email clients of MBOX which include AppleMail, Opera, Thunderbird and SeaMonkey effortl…
Suggested Courses

593 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