Reply to Re: Appending style sheet elements

Your name:

Reply:


Posted by Thomas 'PointedEars' Lahn on 12/02/07 11:33

Neredbojias wrote:

> With neither quill nor qualm, delraydog@gmail.com quothed:
>> How can I use JavaScript to append my own style sheet information to a
>> possibly already existing stylesheet definition?
>
> That's no problem. The latest style is the one honored.

That is not entirely true. It depends on the specificity of the selectors
used.

> Add something like the following to the <head> section:
>
> <script type="text/javascript">
> <!--
> document.write('<style type="text\/css">\n#ct1 { width:95.2%; text-
> align:justify; }\n<\/style>\n');
> document.close;

document.close() refers to a Function(-like) object. The Call Operator ()
is _not_ optional for it to be called. Therefore, the object reference is
only evaluated and nothing is called, preventing the harm it would do
otherwise.

> //-->
> </script>
>
> PS: This example is from one of my pages, has been checked and works.

It probably breaks in NN4 due to the Run-Length bug. It breaks in a
conforming HTML UA due to nonsensical comment delimiter strings, and
it breaks in XHTML due to either comment delimiters (empty `script'
element), or markup delimiters like `<' in PCDATA, or document.write()
not supported there in recent UAs.

BTW: Not all / characters in script data have to be escaped, only
those in an HTML document that would form the ETAGO delimiter </


F'up2 cljs

PointedEars

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация