Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I am developing a Web site using frames (to work on all browsers), and I want to make it so that when I click a link in the top frame and the page loads in the content frame, the title at the top of the window changes. How do I do this correctly without using JavaScript?

"How do I do this correctly without using JavaScript?"
All the solutions I can think of either include server side or client side scripting (except for creating each page separately with the frames or table...that would be beastly.)
I understand not wanting to do it with javascript, but so far as I know, you're stuck with either js or SSI, ASP, PHP, Perl, etc. If one of these is an option, post back and I'll help out.
-SN

Just don't use frames! What you want to do can easily be achieved by simply using a normal HTML web page without frames.
If you're still not convinced, read this.

This has been discussed here before, but I will say again that the reasons linked to in that article are reasons you should use frames wisely, not reasons you should avoid them completely.
Most of the issues they mention can be resolved by reasonably simple javascripting or common sense.
As for browser incompatibility, 99.99% of your users will be using some form of IE, Opera, or Gecko (does opera use gecko? I'm pretty sure mozilla does), and the other .01% are quite used to not seeing stuff displayed right. If a browser can't handle frames, it's unlikely that it will handle tables or images like modern browsers do anyway.
-SN

Come on, frames are ugly and annoying. Maybe if Chad showed us the page we could make a reasoned decision.

"Come on, frames are ugly and annoying."
lol. Nice to see that I'm not the only belligerent egotist roaming the forum ;-)Unfortunately, that's one argument against frames that can't be solved with javascript. Personally I don't feel that way, but I definitely understand that we who defend frames are a dying breed...The army of Gondor standing at the gates of Mordor.
-SN

Hi Chad, SN, James, hello everyone
I personally like framed pages when they are created properly.
. :-)
My favorite framed siteWith the exception of very old browsers not being able to view the site I disagree with all of the reasons.
Legal Issues
Why would one design there site to have another site open within it. That's just poor design and not a problem with using frames properly.Search Engines won't list your web site
Search engines (such as Yahoo - which statistics show is the one most frequently used) cannot catalog websites which have been designed in frames. That means more users won't find your website.Again, only if you don't know how to design a framed website. As of right now mesich.com has 627 links from Yahoo, 507 from MSN, and 300 from Google.
One must understand and properly use the NoFrames tag.
Bookmarking Problems
If your entire site uses frames, a visitor often can't bookmark any pages within the site except the first one (the home page).Once again this is incorrect.
http:\\www.mesich.com\format1.html
Try bookmarking the page in the link above and you will see it can be done, if you understand how to create framed sites properly.Having to give directions in addition to the web address
If you want to direct someone to a given page from outside the site, you'll have to give them the main URL (website address) and then tell them how to navigate to find what they want, rather than giving them the direct page's URL.Wrong Again!
Notice, I didn't have to send you to the home page, tell you to click on Troubleshooting and then to click on Win98 Defrag problems.In addition to the hassle of having to give directions, if you give them the individual page's URL, they will get that page alone, devoid of the frameset (and probably the navigation which would normally be included in another frame).
That's two wrong in the same reason. Notice in the above link the Main page loads along with the Title Page and the Menu Page, in other words, it is not an orphaned page.
P.S.
Thank you again SN for helping us get this one worked out. :-)Another site wants to link to a page on your site, but can't
Another site can't link to a page within your site, only the home page. Or if they are clever enough to link to an inner page, then the user again gets the linked page alone, without the rest of the frameset.Wrong again? Yes, wrong again. :-)
Problems reloading frame-based web sites
You sometimes can't successfully reload/refresh any page within a frameset. What may happen is that you visitor gets taken back to the web site's home page. You have to pay special attention to your code to get this to work right.This one can also be overcome. We did not implement it as I cannot think of any reason for our particular site a need to Refresh the page. Information is not constently changing there.
On another note any frame within a framed page can be refreshed by right clicking in the frame to be refreshed and selecting Refresh.
A couple of reasons we chose to use a framed site.
1. We have somewhere in the neighborhood of 70 pages on the site. If this was done outside of frames and we wanted to add something to the menu, we would have to make the change on all 70 pages. With the framed site we make one change to the menu.html page and are done. Same thing goes with the title page.
2. Once the page is loaded navigation is faster as the only thing reloading is the main frame. The Title and Menu do not have to reload.
By the way I don't find our site "ugly" or "annoying".
That's just my bias opinion though. :-)Thanks again SN for all of your help.
Thanks to The Count, co-webmaster, for all of his hard work on the site and also to Wmmike.
Best Regards,
Mesich

mesich-
I'm glad you took the time to address each one individually...Much better for future potential frames users than my vague "solve it with javascript" defense:-)"we would have to make the change on all 70 pages."
Most people who choose not to use frames use some kind of server side processing to be able to keep navigation in one file. SSI, PHP, Perl, and ASP can all do it. But it is quite a bit more painful, and won't work with the majority of free web hosts (which don't support those technologies.)-SN

Hi SN, hello everyone
It was my pleasure. :-)
I continue to learn more from you all the time. :-)
I'm not all that familiar with PHP, I've been reading a lot about it though. The Guestbook on mesich.com was created with PHP, not by me of course. :-) It was created by a 14yr. old, Wmmike, whom lives in the Netherlands. A very talented young man he is.
We switched host a while back because of the limitations. We found IPowerWeb and it's great for what we are doing, at a very reasonable price.
It also supports all of the technologies you mention above.
Best Regards,
Mesich

Thanks for the input. The fact of the matter is that I am going to use frames.
One reason being is that I have to position a strip of tabs at the bottom of a box at the top, and I would have to use javascript or css that would only work with IE without frames (I'll look into that further though).
Another reason being that I have it so that the background stays put, and when the page is scrolled down, the top disappears and it looks really ugly. I don't have an example, but trust me. If there was a way to make a box at the top of the page stay put when the page is scrolled, that would be great. CSS position: fixed (or static, not sure) does not work in IE.
I am coding the page carefully so that it works with google. I make it so that if a content page loads without the entire frame, it reloads the entire page with frames.
The site I am making is for my brother's translation business.
But in a nutshell, the page has a top bar about 90 pixels high, then a content pane below that takes up the rest.
In the top bar, at the very top, there is a row of flags to select the language. At the very bottom of the top bar is a row of tabs to select the different sections of the site.
In the content pane, I have a map of the world (light gray) as the background (looks very nice in a fixed position). Like I said, it looks bad when the page is scrolled and the top bar disappears.
How would YOU (SN) make the title of the page change when a tab is selected and a new page is loaded in the content pane? Just give me the general idea of how you would do it with whatever [language] (PHP, HTML markup, whatever) and I can do it.
THANKS! CHEERS!

The simplest solution (with what you've described) is to put the following in each content page:
<SCRIPT language="javascript">
top.document.title="this document's title";
</SCRIPT>Good luck,
-SN

According to my book, all javascript-enabled browsers recognize parent, document, and title, so it is as compatible as any js out there. It tested O.K. in NS 7.1 and IE 6.0.
-SN

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |