Why this code is invalid?

G

Guest

Hello,
Here's my invalid code in the shortened version:
=============
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN">
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-2">
<title></title>

</head>
<body>
</body>
</html>
==================
http://validator.w3.org/ says:

Error Line 9 column 5: document type does not allow element "BODY" here.
<body>

Error Line 11 column 6: end tag for "HTML" which is not finished.
</html>

What's wrong?

Regards,
Talthen
 
G

Guest

<[email protected]>
<<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN">

Heh, should be:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

Regards,
Talthen
 
A

Arne

Once said:
<[email protected]>
<<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN">

Heh, should be:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

Yepp, if you have site built with frames, only the frameset file use
the frameset DTD. All other pages should have the transitional DTD,
but better than showed above is

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

and

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">

to make the pages rendered in standard mode, not quirks mode :)

--
/Arne
Now killing all top posters and posters who don't quote
* How to post: http://www.cs.tut.fi/~jkorpela/usenet/brox.html
* From Google: http://www.safalra.com/special/googlegroupsreply/
-------------------------------------------------------------
 
G

Guest

Arne said:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">

to make the pages rendered in standard mode, not quirks mode :)

Well... without DOCTYPE pages are smaller :p Also px in width, type in
<script and <title are things that, when ommitted make the page smaller :]
Even Mozilla can render such pages, however I don't understand why MSIE and
Opera can understand this:
document.forms[0].goto.value=x;
and Mozilla can't. W3C validator also doesn't make errors on it. Stupid
mozilla- I lost few hours to find this out :p

Regards,
Talthen
 
J

Jonathan N. Little

Arne said:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">

to make the pages rendered in standard mode, not quirks mode :)


Well... without DOCTYPE pages are smaller :p Also px in width, type in
<script and <title are things that, when ommitted make the page smaller :]
Even Mozilla can render such pages, however I don't understand why MSIE and
Opera can understand this:
document.forms[0].goto.value=x;
and Mozilla can't. W3C validator also doesn't make errors on it. Stupid
mozilla- I lost few hours to find this out :p

No your problem is 'goto' is a JavaScript reserve word!!!

JavaScript Reserve Words:

abstract, boolean, break, byte, case, catch, char, class, const,
continue, debugger, default, delete, do, double, else, enum, export,
extends, false, final, finally, float, for, function, goto, if,
implements, import, in, instanceof, int, interface, long, native, new,
null, package, private, protected, public, return, short, static, super,
switch, synchronized, this, throw, throws, transient, true, try, typeof,
var, void, volatile, while, with

Change the name and it works just fine, Mozilla is just being smart
enough to know that you made an error:


<script type="text/javascript">
function proof(){
var x="Some value";
document.forms[0].notgoto.value=x;
}
</script>
<form>
<input name="notgoto" type="text">
<input type="button" onclick="proof()" value="Works">
</form>


Try for yourself ;-)
 
T

Toby Inkster

talthen.z-serwera.o2 said:
document.forms[0].goto.value=x;
W3C validator also doesn't make errors on it.

W3C doesn't have a Javascript validator, does it?
 
A

Arne

Once said:
Arne said:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">

to make the pages rendered in standard mode, not quirks mode :)

Well... without DOCTYPE pages are smaller :p Also px in width, type in
<script and <title are things that, when ommitted make the page smaller :]
Even Mozilla can render such pages, however I don't understand why MSIE and
Opera can understand this:
document.forms[0].goto.value=x;
and Mozilla can't. W3C validator also doesn't make errors on it. Stupid
mozilla- I lost few hours to find this out :p

You must have serious problems with your pages if you have to omit
standard HTML tags to save a few bytes. :)

As allready is said, W3C doesn't have a Javascript validator. So you
may consult the Javascript Consol in Mozilla to see what it says about
the scripts you have.

--
/Arne
Now killing all top posters and posters who don't quote
* How to post: http://www.cs.tut.fi/~jkorpela/usenet/brox.html
* From Google: http://www.safalra.com/special/googlegroupsreply/
-------------------------------------------------------------
 
G

Guest

Arne said:
You must have serious problems with your pages if you have to omit
standard HTML tags to save a few bytes. :)
My pages are very small- usually 2-3 kB of code :]
As allready is said, W3C doesn't have a Javascript validator. So you
may consult the Javascript Consol in Mozilla to see what it says about
the scripts you have.

But it doesn't say it is reserved word, and it is not reserved in Opera and
MSIE. MSIE has invented JavaScript, not Mozilla.

Regards,
Talthen
 
G

Guest

Jonathan N. Little said:
No your problem is 'goto' is a JavaScript reserve word!!!

JavaScript Reserve Words:

abstract, boolean, break, byte, case, catch, char, class, const, continue,
debugger, default, delete, do, double, else, enum, export, extends, false,
final, finally, float, for, function, goto, if, implements, import, in,
instanceof, int, interface, long, native, new, null, package, private,
protected, public, return, short, static, super, switch, synchronized,
this, throw, throws, transient, true, try, typeof, var, void, volatile,
while, with

Thanks for the list :]
However goto is a function and I have goto as a variable. For MSIE and Opera
it makes the difference and MSIE is the inventor of JavaScript.

Regards,
Talthen
 
M

Michael Winter

On 16/10/2005 12:09, (e-mail address removed) wrote:

[snip]
However goto is a function and I have goto as a variable.

Then change those identifiers.
[...] MSIE is the inventor of JavaScript.

Netscape invented JavaScript, and Microsoft /later/ implemented a
similar language named JScript. Both have now been standardised as
ECMAScript by ECMA International, and it is this language that browser
vendors aim to implement.

In JScript, there are future reserved words, and this includes goto. The
difference is that JScript doesn't enforce this list (though it should).
However, even Microsoft states that these words should not be used as
identifiers.

Mike
 
A

Arne

Once said:
Arne said:
You must have serious problems with your pages if you have to omit
standard HTML tags to save a few bytes. :)
My pages are very small- usually 2-3 kB of code :]
As allready is said, W3C doesn't have a Javascript validator. So you
may consult the Javascript Consol in Mozilla to see what it says about
the scripts you have.

But it doesn't say it is reserved word, and it is not reserved in Opera and
MSIE. MSIE has invented JavaScript, not Mozilla.

But at the moment JavaScript suffers from outdated, uninformed, and
inaccessible development methods, supported by the likewise outdated
IE browser. The WaSP DOM Scripting Task Force proposes to solve this
problem by the adoption of unobtrusive DOM scripting, a way of
thinking based on modern, standards-compliant, accessible web
development best practices.

The only way the earlier Netscape versions could get users was to
support the "inventions" from MSIE as good as they could. Opera
probably feel they must do the same in order to draw user to their
browser, at least for the moment.

IE has from the start made a distinct point of being as incompatible
as possible, and gleefully ignored standards such as W3C
recommendations. This still influences the way JavaScript is used,
especially by people who don’t work with it on a regular basis.

Solving these psychological problems requires a new way of thinking
that is more in line with modern, standards-compliant web development
practices. Still, accessibility efforts are too often limited to
saying "Sorry" to users of the wrong browser. Unobtrusive thinking
help to solve this problem.

--
/Arne
Now killing all top posters and posters who don't quote
* How to post: http://www.cs.tut.fi/~jkorpela/usenet/brox.html
* From Google: http://www.safalra.com/special/googlegroupsreply/
-------------------------------------------------------------
 
J

Jonathan N. Little

Jonathan N. Little said:
No your problem is 'goto' is a JavaScript reserve word!!!

JavaScript Reserve Words:

abstract, boolean, break, byte, case, catch, char, class, const, continue,
debugger, default, delete, do, double, else, enum, export, extends, false,
final, finally, float, for, function, goto, if, implements, import, in,
instanceof, int, interface, long, native, new, null, package, private,
protected, public, return, short, static, super, switch, synchronized,
this, throw, throws, transient, true, try, typeof, var, void, volatile,
while, with


Thanks for the list :]
However goto is a function and I have goto as a variable. For MSIE and Opera
it makes the difference and MSIE is the inventor of JavaScript.

Please lookup the meaning of a 'reserve word' in any computer
language...it means that they cannot be use as intentifiers--'cuz their
reserved! That is way the script I wrote changing the name of the input
field from 'goto' to 'notgoto' works!
 
G

Guest

Yeah, sorry ;/ Either I read a stupid article or I just did a mistake. MSIE
invented JScript.

Regards,
Talthen
 
A

Alan J. Flavell

Please take more care over your quoting! Casual readers of your
followup might assume that it was me who made that incorrect
statement.
Yeah, sorry ;/

I hope so!

thanks
 
S

Spartanicus

MSIE invented JScript.

Invent: To design something for the first time.

Microsoft attempted to *copy* Netscape's Javascript by reverse
engineering it (and as you'd expect getting it wrong in places). They
named it Jscript because Netscape had trademarked the name Javascript.
 
N

Neredbojias

With neither quill nor qualm, Alan J. Flavell quothed:
Please take more care over your quoting! Casual readers of your
followup might assume that it was me who made that incorrect
statement.

Ah, don't worry. The non-casual reader takes pains to identify your
mistakes and attribute them correctly.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top