Page 1 of 1

[solved] Javascript causing XHTML Validation Error

Posted: Mon Mar 06, 2006 1:17 pm
by darryladie
I have tried in vain to get this to valid with a strict XHTML doc title.

Any help would be appreciated, would rather not create and external JavaScript file.

Code: Select all

<script type="text/javascript">
	var eE ='mailto:';
	var eA ='someone'+'@'+'mydomain'+'.com';
	document.write('<a href="'+eE+eA+"\" >E-mail This Person</a>");
	</script>
Thanks,

Darryl

Posted: Mon Mar 06, 2006 4:36 pm
by feyd

Code: Select all

<html><head>
<title>foo</title>
<script type="text/javascript"><!--
   var eE ='mailto:';
   var eA ='someone'+'@'+'mydomain'+'.com';
   document.write('<a href="'+eE+eA+"\" >E-mail This Person</a>");
   //--></script>
</head>
<body></body></html>
Validates XHTML 1 Strict

Posted: Tue Mar 07, 2006 3:44 am
by Weirdan
shouldn't the script tags contents be enclosed in CDATA section?

Posted: Wed Mar 08, 2006 10:16 am
by darryladie
Thanks very much feyd :lol:

Posted: Wed Mar 08, 2006 11:12 am
by Chris Corbyn
Weirdan wrote:shouldn't the script tags contents be enclosed in CDATA section?
Can you elaborate on this please? :) I'm inetrested what you mean.