Discussion: js write a <hr>
Afficher un message
Vieux 11/09/2007, 18h35   #17
GreyWyvern
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: js write a <hr>

And lo, Blinky the Shark didst speak in alt.www.webmaster:
> Blinky the Shark wrote:
>> GreyWyvern wrote:
>>
>>> There is, of course, a third option which I have forgotten, and that
>>> is to use an external javascript file.
>>>
>>>
>>> <script type="text/javascript" src="writehr.js"></script>
>>>
>>> In file: writehr.js document.write("<hr />" + "Today's alleged
>>> Yogi-ism:");
>>>
>>>
>>> Although the same caveat about document.write() not working when using
>>> the text/xml or application/xhtml+xml MIME-types still applies.

>>
>> Thanks. I think I will play with this rather than rewriting the whole
>> site or giving up.

>
> Uh. Wait. So you're saying that this still won't validate unless I
> rewrite the site?


In a "real" XHTML document, parsed by the XML parser, document.write()
won't work; but parsed as text/html, it will. Moving the statement to an
external file will allow your document to validate mainly because the
validator only considers one file at a time. An external JS file does not
have to follow any XML rules, instead it is only affected by the MIME-type
of the parent document. eg. certain methods are disabled as explained
earlier.

I still think it would be best for you to switch back to HTML 4.01, though
Then you won't have to worry about any of this.

Grey

--
The technical axiom that nothing is impossible sinisterly implies the
pitfall corollary that nothing is ridiculous.
- http://www.greywyvern.com/orca#search - Orca Search: Full-featured
spider and site-search engine
  Réponse avec citation
 
Page generated in 0,05151 seconds with 9 queries