josef stebegg: Aenderung der style-eigenschaften einer svg-zeichnung

Beitrag lesen

Hallo

Steht ja auch ! (NOT) davor ...

bin schon ein bischen ueberfordert .

bezueglich von gestern Abend.

Danke. fast schon super.
Fuer die letzten Aenderungen genuegte ja ein bischen Hausverstand.
Das funktioniert genauso wie gewuenscht.

Warum eigentlich noch nicht bei
http://www.innonet.at/~jstebegg/g1-kurz.html
(vorerst nur die Straßennamen)
habe doch nur zwei-drei Namen ausgetauscht.
..elements.nebenstr.option= Null oder kein Objekt !?
Die einbindung ueber <object> oder <embed> macht keinen Unterschied.
...............
kreise.html
<script language="JavaScript" type="text/javascript">
<!--
function NeueFarbe2SVG()
{
  var d,k,svgobj;
  d=document.forms[0];
  k=d.elements["nebenstr"].options[d.elements["nebenstr"].selectedIndex].value;

if(k!="Auswahl")
  {
    svgobj=document.getElementById("svgkreise").getSVGDocument();
    svgobj.getElementById(k).getStyle().setProperty("fill","#ff00ff");
  }
}
//-->
</script>
</head>
<body>
<object id="svgkreise" data="kreise.svg" width="700" height="400" type="image/svg+xml">SVG-Objekt - Viewer</object>
<form action="">
<select name="nebenstr" onchange="NeueFarbe2SVG()">
<option value="Auswahl">Kreis</option>
<option value="k1">Kreis 1</option>
<option value="k2">Kreis 2</option>
<option value="k3">Kreis 3</option>
<option value="bezirk">bz</option>
<option value="volk">vo</option>
<option value="heg">herreng</option>
</select>
</form>
</body>
</html>
..... kreise.svg
<?xml version="1.0" encoding="iso-8859-1"?>
<!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="700" height="400" >
 <defs>
  <style type="text/css">
   <![CDATA[
    .kunst { stroke:#c99;stroke-width:1;fill:#f0b5a0; }
    .allg { stroke:#99c;stroke-width:1;fill:#b0c4de; }
    .txt32  { font-family:'Arial'; font-size:32; baseline-shift:-8; }
  ]]>
  </style>
 </defs>
  <circle id="k1" cx="100" cy="50" r="20" style="fill: #F00"/>
  <circle id="k2" cx="220" cy="50" r="30" style="fill: #090"/>
  <circle id="k3" cx="360" cy="50" r="40" style="fill: #00C"/>
 <g transform="translate(-20 20) scale(0.4)">
  <path id="bezirk" style="fill: #F00" d="M880 628 821 604 824 598 803 587 814 565 825 560 848 522 905 549 917 547 925 521 943 531 929 578 893 561 879 583 889 589 885 594 902 605 898 613 889 611 886 614 z"/>
  <path id="volk" class="kunst" d="M831 678 875 683 878 655 890 655 892 637 881 637 879 634 867 634 867 630 855 630 856 636 835 636 833 661 z"/>
<g id="straszen" style="fill:#099;">
<path id="herreng" class="strasze2" d="M766 797 825 868 894 949 950 1018 1034 1111"/>
<text id="heg" class="txt32"><textPath xlink:href="#herreng" startOffset="0">H e r r e n g a s s e</textPath></text>
</g>
</g>
</svg>

mfG
josef