[thelist] Javascript newbie - errors
Jeff Howden
jeff at jeffhowden.com
Sat Oct 25 20:52:05 CDT 2003
kristof,
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> From: Kristof Neirynck
>
> The rest of my comment is much less flattering, sorry.
>
> You send your XHTML 1.1 page with the "text/html"
> mimetype. That is considered harmful.
> <http://www.hixie.ch/advocacy/xhtml>
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
blah. a bunch of contradictory rhetoric that goes round and round in
circles like a dog chasing it's tail; and nearly as useful too.
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> To fix this you have three options:
> 1. Send your page as "application/xhtml+xml" to all
> browsers. Internet explorer will no longer open
> your page.
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
bad idea.
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> 2. Send your page as "application/xhtml+xml" for the
> browsers that support it.
> <http://www.webstandards.org/learn/askw3c/sep2003.html>
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
requires server-side knowledge and user-agent sniffing which is, itself,
error-prone. another bad idea.
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> 2a) This will break your javascript
> document.write() does not work in Gecko-based
> browsers.
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
wow, like i needed another reason to shake the banishing stick at
gecko-based garbage.
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> Solution: you'll need the learn the DOM-way of doing
> this.
> <http://www.xs4all.nl/~ppk/js/index.html?/~ppk/js/dom1.html>
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
a fine and noble idea. however, there's nothing wrong with using
document.write() in some circumstances.
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> 2b) This will make your css (and inline javascript)
> invisible You put your css between comment tags.
> <style type="text/css" media="all">
> <!--
> THIS IS COMMENT.
> IT WILL BE IGNORED.
> -->
> </style>
> <script type="text/javascript">
> <!--
> THIS IS COMMENT.
> NOTHING HERE.
> -->
> </script>
> Solution: put your css in an external file and get
> rid of the comment tags in your inline javascript
> or get rid of the inline javascript.
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
that's understandable, but it makes the use of imported stylesheets alittle
cumbersome. for example, suppose you have an imported stylesheet that needs
to be defined *after* another stylesheet. you can either place the @import
declaration within a <style> block without comments, risking that bit doing
bad things in browsers that don't know what a <style> tag is, or place it in
an external stylesheet and reference that stylesheet with a <link> tag,
making just that much more to manage.
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> 3. Change your doctype to XHTML 1.0 and keep sending it
> as text/html. You still should consider fixing your
> css and inline javascript, but that should not be a
> problem.
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
sounds by far the best solution of the lot.
.jeff
------------------------------------------------------
Jeff Howden - Web Application Specialist
Resume - http://jeffhowden.com/about/resume/
Code Library - http://evolt.jeffhowden.com/jeff/code/
More information about the thelist
mailing list