XHTML: <![CDATA[..script..]]>

R

Ralf Schneider

Hi there,
can anybody help me?

It won't work! Why?
My declaration:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Title</title>
<script language="JavaScript1.1" type="text/javascript">
<![CDATA[
<!--
...script ...
// -->
]]>
</script>
</head>
<body>
<noscript>
<p>Noscript</p>
</noscript>
</body>
</html>

It works without "<![CDATA[..script..]]>"!
Thanks for helping!
Ralf
 
M

m

Toby said:
Ralf Schneider wrote:




Current browsers aren't proper SGML interpreters, so don't understand it.

I think this is right. It's really no
trouble to push javascript to a sperate
file, anyway, so the questioner need not
fret over it.

HTMLTidy uses a hack to get CDATA to
work with CSS by commenting out the
CDATA declaration with CSS comment tags:
<head>
<style type="text/css">
/*<![CDATA[*/
h4{background:#a54b0d;color:white;width:250px}
/*]]>*/
</style>
</head>

But it's all so ugly.
Just push the stuff out to
sperate linked files so multiple pages
can use them. The difference in
download times on any decent server
will only be a fraction of a second.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,521
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top