Stefan said:
window.open() will always (try to) open a new window. If you want to
load a new document in the current window/tab, use the |window.location|
object.
Only if that does not break (backward/forward) navigation.
Browsers support assigning a URL string to the window.location object
directly; it has the same effect as assigning to its href property. The
latter is better style, IMO. The former was probably intended as a
shortcut, and can't be dropped now because it's too widely used. Anyway,
both assignments have "magical" side effects (=load a new document).
The difference is, or at least was, that the `href' property of Location
instances was/is "tainted", while the `location' property of Window
instances was/is not. That means that the `location' property was/is not
subject to the Same Origin Policy, thus could/can be used for accesses that
the Policy would normally forbid.
<
http://docs.sun.com/source/816-6409-10/sec.htm#1021266>
(Note: Nowadays [since JavaScript 1.4, and never in JScript or other
implementations] those host objects are no longer part of the programming
language but of the DOM implementation. However, that tainting was removed
in JavaScript 1.2 is incorrect; instead, it appears to have been enabled by
default for at least the Gecko DOM.)
<script type="text/javascript">
[typo fixed]
@paul: This is the correct way to open a script tag.
It is the _start tag_ of a script _element_. The element is _started_, not
opened, and _ended_ (with an end tag), not closed. (When I started Web
development, I did that one wrong, too. Some kind people pointed me to the
Specification then.)
The language attribute is obsolete,
No, it is _deprecated_ in HTML, which is different (declared for
Transitional variants, not so for Strict variants). If it was *obsolete*
already, the current HTML Specification (4.01) would not define it at all.
IOW: the terms "deprecated" and "obsolete" must be set in relation to a
specific version of a specific markup language.
language="JScript" will only work in Internet Explorer
No, it is going to work in all MSHTML-based browsers, but probably not many
others (so not in Gecko-based ones, like Firefox/Iceweasel).
(an unnecessary restriction in your case),
Yes, it is at least unwise and of course invalid without the `type' attribute.
and element names are usually written in lower-case (today).
,-<
http://www.flightlab.com/~joe/sgml/faq-not.txt>
|
| Q. How do I get the current element name in XSLT?
|
| A. That's element *type* name, dammit!
It is not a requirement as element _type names_ are case-insensitive in
HTML, but it helps compression (e.g., with `Transfer-Encoding: gzip', or on
a compressed server filesystem) as lowercase letters are prevalent in
Latin-based texts, thus usually compress better than equivalent uppercase
letters. It also helps migration to XHTML where lowercase element type
names and attribute names are required (which is what you might mean by
referring to "today"; keep in mind though that XHTML support is still not
prevalent in user agents -- most notably IE/MSHTML does not support it --,
and that XHTML 2 development was recently reduced/suspended by W3C in favor
of development of HTML 5.)
@Paul: A (not so minor) nitpick: lose the HTML comments inside your
script. The way you use them makes your HTML invalid,
No, evidently it doesn't. The reason is that the content of the *HTML*
`script' element is declared CDATA, not PCDATA. So it is not parsed (except
of the `</' [ETAGO delimiter] which ends the element content). Just run it
through <
http://validator.w3.org/> to see for yourself.
It would be syntactically invalid script and XHTML code, of course.
and the times where scripts had to be hidden from the browser are long gone.
Definitely. HTML 3.2, which introduced the `script' element and mandates
that user agents should hide the element's content dates back to 1997-01 CE.
<script type="text/javascript">
function loadBSNLinks () {
document.getElementById("linkMsg").style.display = "block";
window.setTimeout("window.location.href = 'bsnlinks.htm'", 1000);
}
</script>
<button onclick="loadBSNLinks()">try it</button>
<div id="linkMsg" style="display:none">
Transferring to bsnlinks.htm
</div>
Set the styles for the linkMsg element so that it appears as a pseudo-alert.
The whole idea of the OP is utter nonsense already, and should not be
supported by posting bogus solutions. There has been no real problem
presented to be solved to begin with, and the Web is *haunted* by the
results of such inept attempts at seemingly improving usability, thereby
effectively reducing it, already.
In this case, there is no good reason to force the user to wait one second
before navigating elsewhere. Do you really think they bought a fast
computer to let it show someone's wait message?
PointedEars