[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

FRAMES - CHANGING

Posted on 2000-01-03
17
Medium Priority
?
155 Views
Last Modified: 2010-04-09
I've created a program in HTML which has five frames - one row at the top of the page, one narrow row at the bottom of the page, and a narrow column, a wide column and another narrow column between the top and bottom rows.  My main document, therefore, is a list of framesets.  Each frame displays a document which is defined in the frameset document.  My question is this:  When clicking a link in the left, narrow column, I want to display different documents in the rows and columns. Do I do this by creating a new document with  a different set of framesets? Is that the correct method or is there a more elegant way of doing this?  Thanks in anticipation ... Patricia
0
Comment
Question by:patriciacarmel
  • 7
  • 5
  • 2
  • +2
17 Comments
 
LVL 5

Expert Comment

by:mayhew
ID: 2320900
If I understand your question right, there is an easier way.

What you do is name the frames and then use TARGET in your anchors.

A simple example is at http://www.mayhewnet.com/patricia.htm


Source code is as follows:


patricia.htm
============
<FRAMESET COLS="20%,*">

  <FRAME name="A" SRC="http://www.mayhewnet.com/Cell1.htm">

  <FRAME name="B" SRC="http://www.mayhewnet.com/Cell2.htm">

</FRAMESET>



Here you name your frames "A" and "B" respectively.



Cell1.htm
=========
<A HREF="http://www.microsoft.com" TARGET="B">Microsoft</a>
<br>
<A HREF="http://www.Yahoo.com" TARGET="B">Yahoo!</a>



Here, by specifying TARGET="B", you are telling it to display the web page in the frame named "B".


Let me know if that helps.
0
 
LVL 1

Expert Comment

by:Kenny
ID: 2322214
MayHew's proposal will only work if only the contents of 1 of the frames is changing. If you need to change the contents of more than 1 frame, you need to change the main page (the frameset) or have one of the frames consist of the framesets of the frames that will change.

for example, if the columns in the middle are going to change, but the top and bottom rows will not change, then have your main page consist of 3 frames (top, middle, bottom). The "middle" frame consists of three frames. When a user clicks something, you just change the middle frameset, not affecting the top and bottom.
0
 

Author Comment

by:patriciacarmel
ID: 2322254
As zxr250 points out, Mayhew's answer proposal will work if only the contents of 1 of the frames is changing.  My problem is that I need to change the contents of all the frames, except for one. Perhaps I wasn't clear on that point.
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 

Author Comment

by:patriciacarmel
ID: 2322304
To zxr250 - I need to change the contents of four out of the five frames by clicking one link in one of the frames.  If I understand your answer, the correct course then would be to create a new frameset doc targeting the new contents. Your second suggestion ",,,or have one of the frames consist of the framesets of the frames that will change" in that case would not be applicable.  

I thought the first alternative was probably the way to go but it seems to cumbersome that I wondered if there was a simpler way. I'm still new to HTML and I'm foggy about the best way to do things.  
0
 
LVL 1

Expert Comment

by:Kenny
ID: 2322361
yup...I have always found HTML to be long-winded. Very rarely is it clean and simple. I guess what you can do is only to have your main page consist of 2 frames. 1 that is a fixed page and the other that is a frameset of 4 more frames that keeps on changing.

Good Luck.
0
 

Author Comment

by:patriciacarmel
ID: 2322390
At least I have confirmation that I'm on the right tract. Thanks.
0
 
LVL 5

Expert Comment

by:mayhew
ID: 2322800
Hi patricia,

Sorry I misunderstood your question.

If you're willing to use a tiny bit of javascript, you can do what you want quite easily.

Take a look again at http://www.mayhewnet.com/patricia.htm and tell me if that's what you want to do.

Let me know if that's what you want and I'll post the code, or you can look at the source of Cell1.htm.

You can also easily do it with links instead of buttons.

I haven't tested it on Netscape.  Let me know if that's a concern and I will make sure that it works properly.
0
 
LVL 19

Expert Comment

by:DreamMaster
ID: 2322846
You can change all the frames simply by doing this:

<script language="javascript">
<!--
function changeframes()
{
  top.frame1.location.replace('newframe.html');
  top.frame2.location.replace('newframe.html');
  top.frame3.location.replace('newframe.html');
  top.frame4.location.replace('newframe.html');
}
//-->
</script>

change the frame1 - 4 with the names of Your frames....
the link is like this...

<a href="javascript:changeframes()">Link</a>

Good luck..ask me if You need more help ok?
0
 

Author Comment

by:patriciacarmel
ID: 2322927
Hello Mayhew - Many thanks for your interest. I've actually spent the afternoon creating new files and it's working fine except for one problem that perhaps you can help me with.

When I click the link in the left column (frame), it goes to the new target, with is a new created frameset document associated only with that link. In the new frameset doc, the contents of four of the five frames changes accordingly. However, and here is the problem, the original page (or the first frameset doc) remains open. What do I need to add to the new frameset document to make sure that the original one closes? BTW - I am using javascript, but it's script that was more or less dictated to me and I'm using it without really understanding what I'm doing.
0
 

Author Comment

by:patriciacarmel
ID: 2322954
Here's the first frameset doc:

<HTML>
<TITLE>NICE Documentation CD</TITLE>

<FRAMESET ROWS=140,*,25 FRAMESPACING="0" BORDER="0" FRAMEBORDER="FFFFFF" NORESIZE>

<FRAME SRC="files/topNICE.htm" NAME="topframe" SCROLLING="NO" FRAMEBORDER="0" MARGINHEIGHT="0" MARGINWIDTH="0">



<FRAMESET COLS=155,450,* FRAMESPACING="0" BORDER="0" FRAMEBORDER="FFFFFF" NORESIZE>

<FRAME SRC="files/sideprod.htm" NAME="sideframe" SCROLLING="NO" FRAMEBORDER="0"MARGINHEIGHT="0" MARGINWIDTH="0">
<FRAME SRC="files/center.htm" NAME="centerframe" SCROLLING="AUTO" FRAMEBORDER="0" MARGINHEIGHT="0" MARGINWIDTH="0">

<FRAME SRC="files/right.htm" NAME="rightframe" SCROLLING="NO" FRAMEBORDER="0" MARGINHEIGHT="0" MARGINWIDTH="0">
</FRAMESET>

<FRAME SRC="files/bottom.htm" NAME="bottomframe" SCROLLING="NO" FRAMEBORDER="0" MARGINHEIGHT="0" MARGINWIDTH="0">
</FRAMESET>

</HTML>

Here's the new frameset doc:
<HTML>
<TITLE>NICE Documentation CD</TITLE>

<FRAMESET ROWS=140,*,25 FRAMESPACING="0" BORDER="0" FRAMEBORDER="FFFFFF" NORESIZE>

<FRAME SRC="topLOG.htm" NAME="topframe" SCROLLING="NO" FRAMEBORDER="0" MARGINHEIGHT="0" MARGINWIDTH="0">



<FRAMESET COLS=155,450,* FRAMESPACING="0" BORDER="0" FRAMEBORDER="FFFFFF" NORESIZE>

<FRAME SRC="side.htm" NAME="sideframe" SCROLLING="NO" FRAMEBORDER="0"MARGINHEIGHT="0" MARGINWIDTH="0">
<FRAME SRC="centlog.htm" NAME="centerframe" SCROLLING="AUTO" FRAMEBORDER="0" MARGINHEIGHT="0" MARGINWIDTH="0">

<FRAME SRC="right.htm" NAME="rightframe" SCROLLING="NO" FRAMEBORDER="0" MARGINHEIGHT="0" MARGINWIDTH="0">
</FRAMESET>

<FRAME SRC="bottom.htm" NAME="bottomframe" SCROLLING="NO" FRAMEBORDER="0" MARGINHEIGHT="0" MARGINWIDTH="0">
</FRAMESET>

</HTML>

Is there a way I can put a replace command here (thanks Dreammaster for joining the discussion)?
0
 
LVL 5

Expert Comment

by:mayhew
ID: 2322962
Hi patricia,

Can you post a URL?

I think I know what you're asking for, but I'd like to see it to be sure.
0
 
LVL 5

Accepted Solution

by:
mayhew earned 150 total points
ID: 2322980
Hi patricia,

No need for a URL.  I sent that comment before your code posted.

If I understand your question, what you want to do is include a TARGET="_top" in the link that opens the new frameset.

That will close the original frameset.

Let me know if that works for you.
0
 

Author Comment

by:patriciacarmel
ID: 2322998
Here's the first frameset doc:

<HTML>
<TITLE>NICE Documentation CD</TITLE>

<FRAMESET ROWS=140,*,25 FRAMESPACING="0" BORDER="0" FRAMEBORDER="FFFFFF" NORESIZE>

<FRAME SRC="files/topNICE.htm" NAME="topframe" SCROLLING="NO" FRAMEBORDER="0" MARGINHEIGHT="0" MARGINWIDTH="0">



<FRAMESET COLS=155,450,* FRAMESPACING="0" BORDER="0" FRAMEBORDER="FFFFFF" NORESIZE>

<FRAME SRC="files/sideprod.htm" NAME="sideframe" SCROLLING="NO" FRAMEBORDER="0"MARGINHEIGHT="0" MARGINWIDTH="0">
<FRAME SRC="files/center.htm" NAME="centerframe" SCROLLING="AUTO" FRAMEBORDER="0" MARGINHEIGHT="0" MARGINWIDTH="0">

<FRAME SRC="files/right.htm" NAME="rightframe" SCROLLING="NO" FRAMEBORDER="0" MARGINHEIGHT="0" MARGINWIDTH="0">
</FRAMESET>

<FRAME SRC="files/bottom.htm" NAME="bottomframe" SCROLLING="NO" FRAMEBORDER="0" MARGINHEIGHT="0" MARGINWIDTH="0">
</FRAMESET>

</HTML>

Here's the new frameset doc:
<HTML>
<TITLE>NICE Documentation CD</TITLE>

<FRAMESET ROWS=140,*,25 FRAMESPACING="0" BORDER="0" FRAMEBORDER="FFFFFF" NORESIZE>

<FRAME SRC="topLOG.htm" NAME="topframe" SCROLLING="NO" FRAMEBORDER="0" MARGINHEIGHT="0" MARGINWIDTH="0">



<FRAMESET COLS=155,450,* FRAMESPACING="0" BORDER="0" FRAMEBORDER="FFFFFF" NORESIZE>

<FRAME SRC="side.htm" NAME="sideframe" SCROLLING="NO" FRAMEBORDER="0"MARGINHEIGHT="0" MARGINWIDTH="0">
<FRAME SRC="centlog.htm" NAME="centerframe" SCROLLING="AUTO" FRAMEBORDER="0" MARGINHEIGHT="0" MARGINWIDTH="0">

<FRAME SRC="right.htm" NAME="rightframe" SCROLLING="NO" FRAMEBORDER="0" MARGINHEIGHT="0" MARGINWIDTH="0">
</FRAMESET>

<FRAME SRC="bottom.htm" NAME="bottomframe" SCROLLING="NO" FRAMEBORDER="0" MARGINHEIGHT="0" MARGINWIDTH="0">
</FRAMESET>

</HTML>

Is there a way I can put a replace command here (thanks Dreammaster for joining the discussion)?
0
 

Author Comment

by:patriciacarmel
ID: 2323095
I feel very stupid - I'd forgotten to add the .htm extension to the link that opens the new frameset. It's now working fine.

Thanks everyone, mayhew, zxr250  and DreamMaster for your help. It's good to know that there are such mavens out there.
0
 
LVL 1

Expert Comment

by:sureshkumar
ID: 2323120
hi

I understood your question like this i.e., whenever your clicking in frame you want to update the reamaining frames.If that is your problem I can give solution for that simply difine taragets with frame names.

further queries
suresh kumar
0
 
LVL 19

Expert Comment

by:DreamMaster
ID: 2325553
Nice to of help....

guess i didn't provide the solution though....

ah well...maybe next time...
0
 
LVL 5

Expert Comment

by:mayhew
ID: 2325852
Glad you got it working.  :)
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Question has a verified solution.

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

Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
There's never been a better time to become a computer scientist. Employment growth in the field is expected to reach 22% overall by 2020, and if you want to get in on the action, it’s a good idea to think about at least minoring in computer science …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

591 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