You've used document.write to try to insert SVG content. I think that will only work in HTML. For SVG, you'll have to use DOM methods to do that.
There are a zillion SVG clocks out there, but here's the one I can find easily: http://srufaculty.sru.edu/david.dailey/svg/ballclock.svg You'll see how it retrieves the time and then sets the clock hands. One could just as easily write the time as a string into a text Node. Good luck David From: svg-developers@yahoogroups.com [mailto:svg-developers@yahoogroups.com] On Behalf Of royhoja Sent: Monday, May 14, 2012 11:46 AM To: svg-developers@yahoogroups.com Subject: [svg-developers] Getting current time in svg file... 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> [Non-text portions of this message have been removed] ------------------------------------ ----- To unsubscribe send a message to: svg-developers-unsubscr...@yahoogroups.com -or- visit http://groups.yahoo.com/group/svg-developers and click "edit my membership" ----Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/svg-developers/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/svg-developers/join (Yahoo! ID required) <*> To change settings via email: svg-developers-dig...@yahoogroups.com svg-developers-fullfeatu...@yahoogroups.com <*> To unsubscribe from this group, send an email to: svg-developers-unsubscr...@yahoogroups.com <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/