You are here: Re: cdata and javascript « HTML « IT news, forums, messages
Re: cdata and javascript

Posted by cwdjrxyz on 10/10/98 12:01

On Jan 26, 2:54 pm, Jeff <jeff@spam_me_not.com> wrote:
> I have a bit of javascript that I'd like to hide from the validator.
>
> I thought I could do this:
>
> <script type="text/javascript">
> // <![CDATA[
>
> // ]]>
> </script>
>
> But that doesn't work.
>
> Should I be using XHTML to do this?

You are using at least some xhtml if you are using the CDATA comments.
CDATA is part of xml that may be used in xhtml. you would be allowed
to use it only if your page has an xhtml Doctype. If you get a lot of
errors at the W3C validator in the script that are xml errors in
xhtml, but not errors in html, you may use CDATA comments to hide the
script from an xhtml page, and a page then will validate at the W3C
with the proper xhtml Doctype. You can avoid this whole problem by
using an external script rather than one on the main page. There are a
few things in script on even an html page that must be avoided to
prevent validation errors. These are discussed at the w3c, and if you
make such an error, the validator in the most complete mode often will
tell you where to find information about the error. Some such errors
cause no harm and mainly are formal errors. However some such errors
may cause problems on some browsers and should be avoided.

The only way that anyone can help you in detail is if you post a url
for a page having the problem. Script can be a bit tricky unless you
use it a lot.

 

Navigation:

[Reply to this 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

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