SVG – Learning by Coding

[ mouse-button.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 03/03 thomas@handmadecode.de     -->

​ 9: 10: 
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">

​11: 12: 
  <title>SVG Learning by Coding</title>

13: 
  <desc>SVG-Spezifikation in Beispielen</desc>

​14: 15: 
  <defs>

​16: 17: 
    <script type="text/javascript">

18: 
      <![CDATA[

​19: ​20: 21: 
      function HideContextMenue(mousedown_evt)

22: 
      {

23: 
        mousedown_evt.preventDefault();

24: 
      }

​25: ​26: 27: 
      function Button(click_evt)

28: 
      {

29: 
        var btn,info;

​30: 31: 
        btn=click_evt.getButton();

32: 
        if(btn==0)info="links";

33: 
        else if(btn==1)info="mitte (Scrollrad)";

34: 
        else if(btn==2)info="rechts";

​35: 36: 
        alert("Der Klick kam von: "+info+" ("+btn+").");

37: 
      }

​38: 39: 
      ]]>

40: 
    </script>

​41: 42: 
  </defs>

​43: 44: 
  <text x="20" y="30" style="fill: #000; font-size: 24px">

45: 
    Maustaste abfragen</text>

​46: 47: 
  <circle cx="120" cy="100" r="30" style="fill: #CFC; stroke: #000"

48: 
    onmousedown="HideContextMenue(evt)" onclick="Button(evt)"/>

​49: 50: 
  <text x="75" y="160">Kreis anklicken!</text>

​51: 52: 
</svg>

[zum Anfang]