[solved] Javascript causing XHTML Validation Error

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
darryladie
Forum Commoner
Posts: 62
Joined: Thu Mar 02, 2006 6:14 pm
Location: East Sussex, UK

[solved] Javascript causing XHTML Validation Error

Post 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
Last edited by darryladie on Wed Mar 08, 2006 10:16 am, edited 1 time in total.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

shouldn't the script tags contents be enclosed in CDATA section?
darryladie
Forum Commoner
Posts: 62
Joined: Thu Mar 02, 2006 6:14 pm
Location: East Sussex, UK

Post by darryladie »

Thanks very much feyd :lol:
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post 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.
Post Reply