Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Base target for specified links

Status
Not open for further replies.

jobi

Technical User
Jun 30, 2000
24
NO
In order to use the same discussion board with several layouts, i need to open specified links in different frames.

Example:
Link to opens in _Top
Link to opens in _Blank
Link to has no target

The <base target> tag effects on all links on a page (if the link isn't targeted itself).
I need a &quot;base target&quot; tag/script that effects only on several links.

Any ideas?
 
i'm afraid you'll have to do it &quot;by hand&quot; ... i only see tedious solutions :
- changing all <a href ...> to have a target (or not for the 3rd case)
- set a javascript function :
<a href=&quot;javascript:eek:pen_it(' 'top')>, <a href=&quot;javascript:eek:pen_it(' 'new'), ...and function open_it(a_link, a_target) { if (a_target eq 'top') {top.location=a_link} (if a_target eq 'new' ){window.open(a_link)} else this.location=a_link}
(just a note on it : yes i'm aware that <a href=&quot;javascript:..&quot;> is baaaad practice [mostly because if your client doesn't want to support javascript your page is screwed])
but those are tedious
 
So the most simple solution should be adding target in all links separately. Don't be lazy!

Welcome back to the forum iza!
It's nice to see old fellows coming back :)

 
I can't add target in the links.

I need to use one code in the discussion board. But at the same time, I want some of the links to behave different when the discussion board is enteres from different frames.

I'm not lazy, but I'm not going to write different versions of the discussion board... :)

If I could define in the <head> tag (or somewhere else in another frame) that some of the links should open in a new window, it would be perfect.
 
jobi : there's no way but changing all the links ... even if you could define somewhere that some of the links should open in a new window, you'd still have to tell every link which &quot;type&quot; of link it is ...
starway : i'm glaaaad to be back as well :) - just quitting my current job (they wouldn't allow me to go to tek-tips !) for a new one, soon :)
 
If you can't add the target to the links individually, I'd assume you are using some type of loop, right? What language are you doing it in? Are you using any type of database or anything? There are ways around this problem.

Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top