Dave Taylor answers free tech support questions about a wide variety of business and technical topics, including blogging, iphone help, ipod help, AdSense, MySpace, Sony PSP help, Mp3 players, Windows XP, Windows Vista, Linux, SEO, Mac OS X, Facebook, Twitter and LinkedIn.

How do I get links to work on a frames-based design?

A reader writes:
"I have been reading your "Creating Cool Web Pages (HTML 4), and I just understood how to make frames. However, I am having trouble with my links opening in the same frame.

For example, I have my links in my smaller frame, but all the pages connected to the links keep on opening in the same smaller frame. How do I change it so I can have them open in a new window, or open in the bigger frame?

This is probably the most common challenge people face when they begin to work in a frames-based environment, and the trick to getting this working has two parts: First, you must name each target pane of your frames-based design when you specify it, and Second, you need to use that exact same name as a target attribute with all links you want to point there.

Dave's Answer:

For example, here's a common approach that you might use to specify a frames-based layout. Notice in particular the words in bold:

<frameset cols="100,*">
  <frame src="navbar.html" name="navbar" />
  <frame src="welcome.html" name="main" />
</frameset>
You should recognize this as a two-column layout, where the left column is going to start out with the page "navbar.html" while the right column, the main section of the frame, is going to be "welcome.html" to start.

With me so far?

To have the links in the file "navbar.html" actually affect the content of the other pane of the frames-based design, they must reference the name of the pane as specified in the frame statement: name="main". Here's how that would look:

<a href="http://www.intuitive.com/">Intuitive Systems</a>
Right? No! It's not correct, because I forgot the all-important target attribute. It's easy to do.

Here's the correct version of the link:

<a href="http://www.intuitive.com/" target="main">Intuitive Systems</a>
See the difference? It's not too hard once you remember that you need to specify a target if it's other than the existing pane.

Even better, you can also specify something like:

<base target="main" />
which means that all links on this particular page are now pointing to the other pane. You override this, if needed, with an explicit target="_self".

I hope that clears everything up!



Help others find this article at Del.icio.us, Digg, Netscape, Reddit, and Stumble Upon    

Subscribe!

Never miss another useful Q&A article again! Subscribe to AskDaveTaylor with Google Reader.

Comments
Rather amazingly, there are no comments on this article yet.


I have a lot to say, but ...
Starbucks coffee cup I have a lot to say, and questions of my own for that matter, but most of all I'd like to say thank you for all your efforts on this Web site by buying you a chai!

I do have a comment, now that you mention it!









Remember personal info?


Please note that I will never send you any unsolicited commercial email. Ever.

While I'm at it, please note that by submitting a question or comment you're agreeing to my terms of service, which are: you relinquish any subsequent rights of ownership to your material by submitting it on this site.









Uniblue: Free Virus Scan


Join Me At:
Aloha Social Media Summit, Oct 2008


Search
Find just the answers you seek from among our 1700+ free tech support articles by using our Lijit search engine.


Member of the B5Media Network

Help!





Subscribe to
Ask Dave Taylor!

Add to Google Reader
Add to My Yahoo!
Subscribe in NewsGator Online

RDF   XML

Free Updates!
Sign up and get free weekly updates and special offers on books, seminars, workshops and more.


Recent Entries
Join the List!
Join my author info mailing list, where you'll learn about my upcoming books, speaking gigs, and more!


Book Links
© 2002 - 2008 by Dave Taylor. All Rights Reserved.

Note: This web site is for the purpose of disseminating information for educational purposes, free of charge, for the benefit of all visitors. We take great care to provide quality information. However, we do not guarantee, and accept no legal liability whatsoever arising from or connected to, the accuracy, reliability, currency or completeness of any material contained on this web site or on any linked site.

[whiteboard marker tray]