Go Back   CodingForums.com > :: Client side development > JavaScript programming > DOM and JSON scripting

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 05-14-2012, 04:27 PM   PM User | #1
iamme
New to the CF scene

 
Join Date: May 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
iamme is an unknown quantity at this point
Getting current time...

Hi,
I am trying to add current time to the svg file I have using Ecmascript.
following is the code I have. Unfortunately its not working . can someone help me fix it?
Thank you

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="300" height="300">
<text x="0" y="15" fill="red">It is now
<script type="text/javascript">
<![CDATA[
var currentTime = new Date();
var month = currentTime.getMonth() + 1;
var day = currentTime.getDate();
var year = currentTime.getFullYear();
document.write(month + "/" + day + "/" + year);
]]>
</script>
</text>
</svg>
iamme is offline   Reply With Quote
Old 05-14-2012, 06:20 PM   PM User | #2
sunfighter
Senior Coder

 
Join Date: Jan 2011
Location: Missouri
Posts: 2,376
Thanks: 18
Thanked 350 Times in 349 Posts
sunfighter is on a distinguished road
Would removing the <![CDATA[ tags help?
sunfighter is online now   Reply With Quote
Old 05-14-2012, 06:26 PM   PM User | #3
iamme
New to the CF scene

 
Join Date: May 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
iamme is an unknown quantity at this point
Quote:
Originally Posted by sunfighter View Post
Would removing the <![CDATA[ tags help?
tried it already... no it does not
iamme is offline   Reply With Quote
Old 05-15-2012, 07:06 AM   PM User | #4
Dormilich
Senior Coder

 
Dormilich's Avatar
 
Join Date: Jan 2010
Location: Behind the Wall
Posts: 2,860
Thanks: 9
Thanked 290 Times in 286 Posts
Dormilich is on a distinguished road
removing document.write() would work (as it is not allowed in XML context (violating the well-formedness restriction))
__________________
please post your code wrapped in [CODE] [/CODE] tags
Dormilich 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:26 PM.


Advertisement
Log in to turn off these ads.