About mSLv


  • How to use SVG?

How to use SVG?

Another thing is the using of SVG from within javascript. It is as simple as that:

  1. Create an SVG document. Mine is very simple, it just shows the mSLv background:
    <?xml version="1.0" encoding="utf-8"?>
    <svg>
    <g id="bgControl">
    <image id="background" xlink:href="../img/logo.gif"
        width="760" height="250" image-rendering="optimizeSpeed"/>
    </g>
    </svg>
    
  2. This document is then the source for the SVG embedded thingy:
    <embed name="somename" src="inc/body.svg" type="image/svg-xml" 
    pluginspace="http://www.adobe.com/svg/viewer/install/"
    height="250" width="760">
    To get SVG viewer to install automagically, download the autoinstaller from here. I think I will get rid of the autoinstaller. It relies on checking cookies at adobe site - as smart as locking a fridge with a key stored by your grandma.
  3. Now the only thing you need to do before using SVG, take your svg object (document.somename), call getSVGDocument() method and assign the svg document to some variable.
    SVGDoc = document.somename.getSVGDocument();
    And then you just play with SVGDoc variable!!!
Internet Explorer ≥ 5 , Netscape ≥ 6 (Mozilla ≥ 1.4), Opera ≥ 6
Valid HTML 4.01!