469,645 Members | 1,193 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,645 developers. It's quick & easy.

Intranet Links

I want to place a piece of JavaScript at the top of my page/s that wil
tell all links on that page to open in certain target windows dependin
on the hostname.

Suppose the intranet address is http://intranet
so this means that the hostname is "intranet" right?
If I want all intranet page links to open in the same window but al
other links (ie external internet links) to open in a new windo
(_blank) then would I use something like below? Please correct an
place I've gone wrong:

if(document.links.hostname == "intranet") {
this.target = "_top";
} return true;

But somewhere in there I would also need an "else" statement to tell i
to open all other links in "_blank" target. Can someone please tell m
where that should be added in. I'm fairly new to javascript and am no
exactly sure what order some of this stuff should go in.


Posted via http://www.forum4designers.co
View this thread: http://www.forum4designers.com/message46077.htm

Jul 20 '05 #1
1 1679
"HGJS" <HG*********@mail.forum4designers.com> wrote in message
Posted via http://www.forum4designers.com

form4designers.com is a bad place to read comp.lang.javascript from
because their presentation of the group garbles the Usenet posts it is
derived from and they only report a fraction of the posts made to the
group, giving an incomplete representation.

forumj4designers.com is also a bad pace to ask javascript questions from
because their misrepresentation of the group, combined with deliberate
deceptions about the nature of the service that they provide, have
resulted in a level of resentment of forum4designers.com that will
negatively impact on anyone who decides to associate themselves with
that web site.

Many other sites provide superior web-based access to Usenet, and often
without distortion or omission, including groups.google.com (who also
provide extensive and flexible archive searching facilities). But the
best method of reading and posting to comp.lang.javascript is through a
news server via newsreader software.

Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by HGJS | last post: by
6 posts views Thread by James Owens | last post: by
1 post views Thread by Prasad | last post: by
reply views Thread by naijacoder naijacoder | last post: by
5 posts views Thread by Martin Heuckeroth | last post: by
4 posts views Thread by Darko Konrad | last post: by
9 posts views Thread by =?Utf-8?B?bnV1dHV1ZG5ldA==?= | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.