By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,589 Members | 1,194 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,589 IT Pros & Developers. It's quick & easy.

Why are windows opening as if base target is being used?

P: n/a

I am using the following javascript to make a popup menu allow the
user to navigate to different pages on a website.
Yet it is opening windows as if I have <base target="some-name">
defined in the body.

<script language=javascript>
<!-- Begin
function navigate()
{
open(document.popupForm.popup.options
[document.popupForm.popup.selectedIndex].value,"content");
}
// End -->
</script>

This is the form:

<form name="popupForm">
<select name="popup" onchange="navigate();">
<option selected>Navigate to:
<option value="../../Library">Library
<option value="../Science">Science
<option value="Logos">Logos
</select>
</form>

Can anyone see anything that would be causing this? Thanks for any
help.

Jun 20 '07 #1
Share this Question
Share on Google+
8 Replies


P: n/a
Scripsit pa*********@gmail.com:
I am using the following javascript to make a popup menu allow the
user to navigate to different pages on a website.
Why? Do you want to take extra effort to prevent millions of people from
navigating your site?
Yet it is opening windows as if I have <base target="some-name">
defined in the body.
Well, have you? You didn't specify the URL, so we cannot check that for you.
<script language=javascript>
<!-- Begin
Thinking about Netscape 2, or what?
open(document.popupForm.popup.options
[document.popupForm.popup.selectedIndex].value,"content");
Maybe you should figure out what the open() method does. But not here. This
group is about HTML authoring for the WWW.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Jun 21 '07 #2

P: n/a
RvT
Yet it is opening windows as if I have <base target="some-name">
defined in the body.
BASE should be defined in the HEAD, not the BODY.

Jun 22 '07 #3

P: n/a
RvT
BASE should be defined in the HEAD, not the BODY.

Jun 22 '07 #4

P: n/a
pa*********@gmail.com wrote:
I am using the following javascript to make a popup menu allow the
user to navigate to different pages on a website.
Yet it is opening windows as if I have <base target="some-name">
defined in the body.

<script language=javascript>
<!-- Begin
function navigate()
{
open(document.popupForm.popup.options
[document.popupForm.popup.selectedIndex].value,"content");
}
// End -->
</script>
Yes, that's what the open method (meaning window.open, as window is the
default object in browser scripts when a method is invoked without an
explicit object) was designed to do: open a window. And so it does,
unless the OS or user agent doesn't support multiple windows or the
browser has been configured to open the given URL in a new tab or in the
existing window.
Jun 22 '07 #5

P: n/a
Sorry, I just realized I misunderstood the nature of your question.
Never mind.
Jun 22 '07 #6

P: n/a
Harlan Messinger wrote:
Sorry, I just realized I misunderstood the nature of your question.
Never mind.
Actually, you *were* talking about the target attribute. I just hadn't
realized it could be used in a BASE tag. So what I originally said is
correct: unlike the default behavior for an A tag, windows.open in most
cases, by default, opens a new window.
Jun 22 '07 #7

P: n/a
On Jun 21, 1:26 pm, "Jukka K. Korpela" <jkorp...@cs.tut.fiwrote:
Scripsit paintedj...@gmail.com:
I am using the following javascript to make a popup menu allow the
user to navigate to different pages on a website.

Why? Do you want to take extra effort to prevent millions of people from
navigating your site?
Well, first, the website is limited to my subnet via .htaccess so I
don't want millions of people navigating the website. Secondly, are
you suggesting that it is a poor navigation technique? It works
perfectly now that I solved the problem with the javascript open.
However, I'd be interested in any problems that such a navigation
feature would introduce.

Yet it is opening windows as if I have <base target="some-name">
defined in the body.

Well, have you? You didn't specify the URL, so we cannot check that for you.
<script language=javascript>
<!-- Begin

Thinking about Netscape 2, or what?
I presume that you mean the HTML comment is now unnecessary?

open(document.popupForm.popup.options
[document.popupForm.popup.selectedIndex].value,"content");

Maybe you should figure out what the open() method does. But not here. This
group is about HTML authoring for the WWW.
Since it was my first post on this NG, I mistakenly assumed that it
would cover any topic under HTML. Upon learning the name of the
newsgroup for Javascript, I posted the same question there and learned
what the problem was. By the way, I don't claim to be a Javascript
programmer. I simply borrowed free code on the net in an attempt to
accomplish a desired result. Surely, you don't think that only expert
Javascript programmers are allowed to post here or there
(comp.lang.javascript).

Jun 22 '07 #8

P: n/a
Scripsit pa*********@gmail.com:
It works
perfectly now that I solved the problem with the javascript open.
However, I'd be interested in any problems that such a navigation
feature would introduce.
Are you serious? Turn JavaScript off and check again.
>Well, have you? You didn't specify the URL, so we cannot check that
for you.
Why did you quote that when you had nothing to reply - especially no URL?
Since it was my first post on this NG, I mistakenly assumed that it
would cover any topic under HTML.
Which of the letters in the part "www" did you fail to understand?
I simply borrowed free code on the net in an attempt to
accomplish a desired result.
That's compatible with other foolishness that you have exhibited.
Surely, you don't think that only expert
Javascript programmers are allowed to post here or there
(comp.lang.javascript).
So you still don't know what this group is for, or don't care? Never mind,
you will most probably be ignored here now, except perhaps by people who
share your cluelessness.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Jun 22 '07 #9

This discussion thread is closed

Replies have been disabled for this discussion.