Hi,

 

Try:

 

var obj = document.getElementById("texte");

if(obj && obj.firstChild) obj.firstChild.data = time;

 

Regrads,

Chris

 

From: svg-developers@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of 
Rémi Boulle
Sent: Montag, 8. Oktober 2007 21:32
To: svg-developers@yahoogroups.com
Subject: [svg-developers] SVG countdown

 

Hi,

I get a bit confused about modifying the content of a <text> element.
The more I read, the more I feel confused. :-s
I would like to write a SVG code that will launch a countdown when cliking
on a rectangle (whatever the object).
Here is my code :
****begin****
<?xml version="1.0" encoding="UTF-8"?>
<!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"; width="100%" height="100%" viewBox="0 0 
400 250" onload="init()">
<script type="text/ecmascript">
<![CDATA[
var sec = 20; // set the seconds
var min = 00; // set the minutes
function countDown() {
sec--;
if (sec == -01) {
sec = 59;
min = min - 1; }
else {
min = min; }

if (sec<=9) { sec = "0" + sec; }

<!-- time = (min<=9 ? "0" + min : min) + " min and " + sec + " sec "; -->
time = sec + " sec ";
if (document.getElementById) { document.getElementById("texte").innerHTML = 
time; }

SD=window.setTimeout("countDown();", 1000);
if (min == '00' && sec == '00') { sec = "00"; window.clearTimeout(SD); }
}
]]>
</script>
<text id="texte" x="150" y="50" 
style="text-anchor:middle;font-size:25;font-family:Arial;fill:red">Cliquez sur 
le rectangle pour lancer le décompte</text>
<rect onclick="countDown()" x="50" y="100" width="100" height="50"
style="fill:red"/> </svg>
****end******
I think that I need to replace the "innerHTML" by somethnig else like
:objet.getFirstChild().setData(countDown()) (doesn't work).
Any idea ?
Thanks.
Rémi (using FF2)

 



[Non-text portions of this message have been removed]



-----
To unsubscribe send a message to: [EMAIL PROTECTED]
-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:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Reply via email to