Go Back   CodingForums.com > :: Client side development > XML

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-29-2002, 05:05 PM   PM User | #1
cg9com
Senior Coder

 
Join Date: Jul 2002
Posts: 1,628
Thanks: 0
Thanked 0 Times in 0 Posts
cg9com is an unknown quantity at this point
No, why is THIS not valid

xhtml10 strict:

<script type="text/javascript">
document.write('<a style="color:white" href="'+'mailto:'+'cg9com'+'@'+'juno.com'+'">'+'cg9com'+'@'+'juno.com'+'</a>');
</script>
cg9com is offline   Reply With Quote
Old 11-29-2002, 05:47 PM   PM User | #2
brothercake
Senior Coder


 
Join Date: Jun 2002
Location: near Oswestry
Posts: 4,508
Thanks: 0
Thanked 0 Times in 0 Posts
brothercake is an unknown quantity at this point
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.
brothercake is offline   Reply With Quote
Old 11-29-2002, 06:14 PM   PM User | #3
BrainJar
Regular Coder

 
Join Date: Jun 2002
Posts: 185
Thanks: 0
Thanked 0 Times in 0 Posts
BrainJar is an unknown quantity at this point
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:

Code:
<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.
BrainJar is offline   Reply With Quote
Old 11-29-2002, 08:27 PM   PM User | #4
brothercake
Senior Coder


 
Join Date: Jun 2002
Location: near Oswestry
Posts: 4,508
Thanks: 0
Thanked 0 Times in 0 Posts
brothercake is an unknown quantity at this point
That's interesting; presumably you could also use entities to make it valid, like with XPath?
brothercake is offline   Reply With Quote
Old 11-30-2002, 12:39 AM   PM User | #5
cg9com
Senior Coder

 
Join Date: Jul 2002
Posts: 1,628
Thanks: 0
Thanked 0 Times in 0 Posts
cg9com is an unknown quantity at this point
thanks alot
cg9com is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:46 PM.


Advertisement
Log in to turn off these ads.