Anyone else noticed this issue?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
In XHTML 1.0 Strict, the correct declaration for calling an external
JavaScript is <script type="text/javascript" src="script2.13.js" />
right? Running the validator on my page, I got it being correct as
either the preceding or <script type="text/javascript"
src="script2.13.js"></script>. I would figure one would want to use the
former considering it uses less bytes of data, though largely irrelevant
on most connections.

I'm using Firefox 3.0 B3 and have noticed that the page is blank,
despite it passing validation by the W3 validator. The same page works
in Opera and Firefox though. Not unsurprisingly, it doesn't
work in IE 6. I'm running Linux, so I can't run IE7 currently to test it
in there. It seems to be a bug with the programs not handling the
XHTML+XML declaration, so I submitted a bug report to Mozilla. I just
wanted to see if it was just my computer screwing things up.

I'm learning JavaScript through a book that is using XHTML 1.0
Transitional and these are just scripts from that book. I changed the
code to be Strict because I prefer to use it.

They are online at:

I don't need any feedback on it other than whether or not it works in
the browser you're using.

Thanks for your time.

Justin Miller

Re: Anyone else noticed this issue?

Scripsit Justin E. Miller:

Quoted text here. Click to load it

What makes you think so, and specifically that it is _the_ correct
declaration? Which part of the XHTML 1.0 specification made you draw
that conclusion.

Quoted text here. Click to load it

Does that surprise you? Why?

The following is valid, too, though not correct:

<script type="I made this up!" src="And this too!">Nothing to be seen

Quoted text here. Click to load it

Why are you using XHTML in the first place?

The "self-closing tag" idea, often advertized as fundamental to XHTML,
is generally misunderstood and it wasn't a great idea from the
beginning. An element with EMPTY declared content is generally something
tricky and a symptom of retrofitting a simple quick-and-dirty tagging
system into the formal framework of "generalized markup" (first SGML,
later XML); see

On the technical side, both XML and XHML specifications say clearly that
"for compatibility", the self-closing tag construct should be used for
elements with EMPTY declared content (i.e., for elements that can never
have any content, by the syntax rules), and for them only. So although
<div /> is valid, it should not be used; ditto for <script ... />.

In practice, legacy browsers (especially when in text/html parsing mode)
may well ignore the slash and treat <script ... /> as <script ... >, and
there goes the rest of the document. By HTML _specifications_ up to and
including HTML 4.01, the slash has a special meaning, but completely
different from XHTML rules.

Quoted text here. Click to load it

HTML is best learned from books on HTML. There are many books on HTML.
Unfortunately, most of them are between sloppy and miserable, and the
best one (coauthored by me) is available in Finnish only; sorry. But I'm
sure some of the HTML books often mentioned in this group are good.

Quoted text here. Click to load it

That's the shrewd way of getting feedback on Usenet. :-)

The very first script is this:

document.write("Hello, World!");

It seems that you need a new JavaScript book, too, since such operations
are _so_ outdated. You often see document.write() in legacy code, but
it's _not_ the modern way, especially if playing with XHTML. You're
supposed to manipulate the document tree, using a W3C-approved Document
Object Model, instead of throwing in strings to be parsed as (X)HTML at

Jukka K. Korpela ("Yucca")

Re: Anyone else noticed this issue?

Justin E. Miller wrote:

Quoted text here. Click to load it

Technically, yes. But the behaviour of may current browsers is to
interpret XHTML pages as if they were plain old HTML unless they are
served with an XHTML or XML Content-Type header. Thus your <script>
element may be parsed according to HTML rules, and interpreted as if it

    <script type="text/javascript" src="script2.13.js">

That is, no closing tag -- so the remainder of the page is seen as being
*part* of the script!

Quoted text here. Click to load it

Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux, up 37 days, 17:22.]
[Now Playing: Ray Charles - Funny but I Still Love You]

                               Bottled Water

Site Timeline