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

Posted by Jeff on 10/06/87 12:01

cwdjrxyz wrote:
> 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.

Thanks. I understand this now. I've never used either xhtml doctypes and
cdata. I thought it may have been time to learn them. Or not!

You can avoid this whole problem by
> using an external script rather than one on the main page.

I'll do that later. I think that's a good plan anyways!

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,

You know, I read through that already and they just took me around in a
circle!

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.

It's an odd thing, but here you are:

<URL: http://websiterepairguru.com/colorpicker_2.htm>

I don't expect you to hack through that, but if you have issues
figuring out color schemes like I do, it may be interesting... There's
some bugs (see next thread) when I added the strict doctype.

I wrote the left part of that back in '99 and I'm just trying to get
it up to date.

Thanks,
Jeff

>

 

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

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