HTML Tutorial


 Forum HomeForum Home   FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
RegisterRegister - Not registered yet? Got something to say? Join HTML Code Tutorial!
Help Please!!!
Post new topic   Reply to topic    HTML Help Forum Index -> HTML Frame
View previous topic :: View next topic  
Author Message
IonDune



Joined: 22 May 2005
Posts: 12

PostPosted: Sun May 22, 2005 1:35 pm     Help Please!!! Reply with quote

I am making my site using frames. I have a titlebar frame at the top, a frame at the side with links for other parts of my site, and a larger frame in the center that holds the info the page is holding.

my problem is that when i click a link from the frame on the side it opens the link inside that frame. I need a way for a link to not open a link in the frame, but to open a whole new page. Can i do this?
Corey Bryant
Site Admin


Joined: 15 May 2004
Posts: 8316
Location: Castle Pines North, CO USA

PostPosted: Sun May 22, 2005 2:15 pm     Reply with quote



Try adding
Code:
target="_blank"

to the a href tag

If you are working in XHTML strict, create a js file:
Code:
function externalLinks() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&
       anchor.getAttribute("rel") == "external")
     anchor.target = "_blank";
 }
}
window.onload = externalLinks;

and name it external.js

Now add this to your webpage
Code:
<script type="text/javascript" src="/external.js">
</script>

And then to apply it:
Code:
<a href="http://www.loud800.com" rel="external">
IonDune



Joined: 22 May 2005
Posts: 12

PostPosted: Sun May 22, 2005 2:18 pm     Reply with quote

umm sorry i'm kind of new to this...

i am using geocities and this is what the code is on my page:

<HTML>
<HEAD>
<TITLE>IonDuneCentral</TITLE>
</HEAD>

<FRAMESET ROWS="15%,*">
<FRAME SRC="titlebar.html" NAME=TITLE SCROLLING=NO>

<FRAMESET COLS="20%,*">
<FRAME SRC="sidebar.html" NAME=SIDEBAR>
<FRAME SRC="mainpage.html" NAME=RECIPES>
</FRAMESET>
</FRAMESET>

</HTML>

what should i add so that the links in the "sidebar.html" change whats in the area"mainpage"?
Corey Bryant
Site Admin


Joined: 15 May 2004
Posts: 8316
Location: Castle Pines North, CO USA

PostPosted: Sun May 22, 2005 2:26 pm     Reply with quote

You should add
Code:
target="_blank"

to the hyperlink you want to open in the new window.

For example, if you have
Code:
<a href="http://www.cnn.com">CNN</a>

you would add:
Code:
<a target="_blank" href="http://www.cnn.com">CNN</a>
IonDune



Joined: 22 May 2005
Posts: 12

PostPosted: Sun May 22, 2005 2:34 pm     Reply with quote

thankyou, that solved my first problem, but i wanted it to open in the same window, just not in the individual frame. how could i do that?

EDIT: Wait i figured it out. mayeb i should have payed more attention to what u said the first time... lol ty


Last edited by IonDune on Sun May 22, 2005 2:39 pm; edited 1 time in total
Corey Bryant
Site Admin


Joined: 15 May 2004
Posts: 8316
Location: Castle Pines North, CO USA

PostPosted: Sun May 22, 2005 2:37 pm     Reply with quote

Change the target to the name of the frame you want it to open in
IonDune



Joined: 22 May 2005
Posts: 12

PostPosted: Sun May 22, 2005 2:39 pm     Reply with quote

thank you i got it working.
Corey Bryant
Site Admin


Joined: 15 May 2004
Posts: 8316
Location: Castle Pines North, CO USA

PostPosted: Sun May 22, 2005 2:41 pm     Reply with quote

Anytime - good luck with the site!
Display posts from previous:   
Post new topic   Reply to topic    HTML Help Forum Index -> HTML Frame All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
HTML Help Archive
Powered by phpBB © 2001, 2005 phpBB Group
HTML Help topic RSS feed 

 
HOSTING / DESIGN
MAKE MONEY

Home
  |   Tutorials   |   Forum   |   Quick List   |   Link Directory   |   About
Copyright ©1997-2002 Idocs and ©2002-2007 HTML Code Tutorial