...

No, why is THIS not valid

cg9com
11-29-2002, 05:05 PM
xhtml10 strict:

<script type="text/javascript">
document.write('<a style="color:white" href="'+'mailto:'+'cg9com'+'@'+'juno.com'+'">'+'cg9com'+'@'+'juno.com'+'</a>');
</script>

brothercake
11-29-2002, 05:47 PM
Unless i'm much mistaken, inline javascript is not permitted in XHTML. If you put that code in an external .js file, it should validate fine.

BrainJar
11-29-2002, 06:14 PM
There's no explicit restriction on using inline scripts with XHTML, but any occurance of "<" or ">" in the script code will cause a problem.

To get around that you can use a CDATA section:


<script type="text/javascript">// <![CDATA[

document.write('<a style="color:white" href="'+'mailto:'+'cg9com'+'@'+'juno.com'+'">'+'cg9com'+'@'+'juno.com'+'</a>');

// ]]></script>


Text within a CDATA section will be ignored by the XML parser.

Also, if you use document.write() to generate HTML dynamically, you need to be sure that HTML is valid.

brothercake
11-29-2002, 08:27 PM
That's interesting; presumably you could also use entities to make it valid, like with XPath?

cg9com
11-30-2002, 12:39 AM
thanks alot



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum