SVG – Learning by Coding

[ lauftext.svg --> Grafik anzeigen ]

 1: <?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
 2: <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
 3:   "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd" [
 4:   <!ATTLIST svg xmlns:xlink CDATA #FIXED "http://www.w3.org/1999/xlink">
 5: ]>
 6: 
 7: <!-- SVG Learning by Coding http://www.datenverdrahten.de/svglbc/ -->
 8: <!--    AuthorDrThomas Meinike 12/02 thomas@handmadecode.de     -->
 9: 
10: <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
11:   onload="Ticker()">
12: 
13:   <title>SVG Learning by Coding</title>
14:   <desc>SVG-Spezifikation in Beispielen</desc>
15: 
16:   <defs>
17: 
18:     <script type="text/javascript">
19:       <![CDATA[
20: 
21:       var svgdoc,element,ltxt,i,l;
22:       svgdoc=document.documentElement;
23:       // oder svgdoc=getDocument().documentElement;
24:       element=svgdoc.getElementById("lauftext");
25:       ltxt="Das ist ein Lauftext und der läuft und läuft ... ";
26:       i=0;
27:       l=ltxt.length;
28: 
29:       function Ticker()
30:       {
31:         txt=ltxt.substring(i,l)+ltxt.substring(0,i-1);
32:         element.childNodes.item(0).data=txt;
33:         // oder element.firstChild.data=txt;
34:         if (i<l)i++;
35:         else i=0;
36:         setTimeout("Ticker()",150);
37:       }
38: 
39:     ]]>
40:     </script>
41: 
42:   </defs>
43: 
44:   <text x="20" y="30" style="fill: #000; font-size: 24px">Lauftext mit JavaScript</text>
45: 	
46:   <text id="lauftext" x="20" y="80" style="fill: #F00; font-size: 20px">Lauftext</text>
47: 
48: </svg>

[zum Anfang]