View Single Post
Old 09-15-2003, 07:09 PM   PM User | #1
sweenster
Regular Coder

 
Join Date: Sep 2002
Location: Scotland
Posts: 407
Thanks: 0
Thanked 0 Times in 0 Posts
sweenster is an unknown quantity at this point
correct way to include a javascript in XHTML document

I have this javascript to spam-protect my email address:

Code:
<script language="javascript">
	var name = "brian";
	var domain = "sweenster.co.uk";
	document.write('<a href=\"mailto:' + name + '@' + domain + '\">');
	document.write(name + '@' + domain + '</a>');
</script>
this works fine, but whenever I try to validate my code it fails - because of the language attribute and the fact that i'm printing HTML tags.

How would I fix this??

I have tried removing, changing & manipultaing both but with no success.
__________________
My body's a temple... and like those ancient Greek ones it's a ruin
sweenster.co.uk
sweenster is offline