Loading ...
Sorry, an error occurred while loading the content.

RE: [svg-developers] help. inline svg problem

Expand Messages
  • Chris Peto
    Hi, There were two problems: First, the Javascript was in the header so the init function was never called. Second, you needed to use the event. This works:
    Message 1 of 2 , Jul 17, 2003
    • 0 Attachment
      Hi,

      There were two problems:

      First, the Javascript was in the header so the init function was never
      called.

      Second, you needed to use the event.

      This works:

      <HTML xmlns:svg="http://www.w3.org/2000/svg">
      <object id="AdobeSVG"
      CLASSID="clsid:78156a80-c6a1-4bbf-8e6a-3cd390eeb4e2">
      </object>
      <?import namespace="svg" implementation="#AdobeSVG"?>
      <HTML>
      <!-- Copyright 2000 Adobe Systems. You may copy, modify,
      and distribute this file, if you include this notice and
      do not charge for the distribution. This file is provided
      "AS-IS" without warranties of any kind, including any
      implied warranties.
      -->
      <HEAD>


      <TITLE>Stars and Stripes</TITLE>
      </HEAD>
      <BODY BGCOLOR="#EEEEEE" >
      <SCRIPT language="Javascript">
      function init(evt){

      var SVGDoc = evt.target.getOwnerDocument();
      //SVGPlugin = document.getElementById("AdobeSVG");
      //SVGPlugin = document.getElementById("mysvg");
      alert(SVGDoc);
      //SVGRoot = document.getSVGDocument();


      //alert(SVGRoot);

      }
      </SCRIPT>
      <H1>Animated SVG Example</H1>
      <svg:svg id="mysvg" width="400" height="240" viewBox="0 0 1000 600"
      onload="init(evt)">
      <svg:g transform="translate(10 60)">
      <svg:defs>
      <svg:rect id="r" width="900" height="40"
      style="fill:#dd0000" shape-rendering="optimizeSpeed"/>
      <svg:rect id="w" width="900" height="40"
      style="fill:white" shape-rendering="optimizeSpeed"/>
      <svg:polygon id="s" style="fill:white;fill-
      rule:nonzero;"
      points="0,-14 8.229,11.326 -13.315,-4.326
      13.315,-4.326 -8.229,11.326">
      <svg:animateTransform
      attributeName="transform" type="rotate" values="0;360" dur="3s"
      repeatDur="indefinite" />
      </svg:polygon>
      <svg:g id="6">
      <svg:use xlink:href="#s" x="20"/>
      <svg:use xlink:href="#s" x="90"/>
      <svg:use xlink:href="#s" x="150"/>
      <svg:use xlink:href="#s" x="210"/>
      <svg:use xlink:href="#s" x="270"/>
      <svg:use xlink:href="#s" x="330"/>
      </svg:g>
      <svg:g id="5">
      <svg:use xlink:href="#s" x="60"/>
      <svg:use xlink:href="#s" x="120"/>
      <svg:use xlink:href="#s" x="180"/>
      <svg:use xlink:href="#s" x="240"/>
      <svg:use xlink:href="#s" x="300"/>
      </svg:g>
      </svg:defs>
      <svg:use xlink:href="#r"/>
      <svg:use xlink:href="#w" y="40"/>
      <svg:use xlink:href="#r" y="80"/>
      <svg:use xlink:href="#w" y="120"/>
      <svg:use xlink:href="#r" y="160"/>
      <svg:use xlink:href="#w" y="200"/>
      <svg:use xlink:href="#r" y="240"/>
      <svg:use xlink:href="#w" y="280"/>
      <svg:use xlink:href="#r" y="320"/>
      <svg:use xlink:href="#w" y="360"/>
      <svg:use xlink:href="#r" y="400"/>
      <svg:use xlink:href="#w" y="440"/>
      <svg:use xlink:href="#r" y="480"/>
      <svg:rect id="b" width="360" height="280"
      style="fill:#000088" shape-rendering="optimizeSpeed"/>
      <svg:rect id="border" width="900" height="520"
      style="fill:none;stroke:black;stroke-width:0.85"/>
      <svg:g transform="translate(4.5 0)">
      <svg:use xlink:href="#6" y="20"/>
      <svg:use xlink:href="#5" y="50"/>
      <svg:use xlink:href="#6" y="80"/>
      <svg:use xlink:href="#5" y="110"/>
      <svg:use xlink:href="#6" y="140"/>
      <svg:use xlink:href="#5" y="170"/>
      <svg:use xlink:href="#6" y="200"/>
      <svg:use xlink:href="#5" y="230"/>
      <svg:use xlink:href="#6" y="260"/>
      </svg:g>
      </svg:g>
      </svg:svg>
      </HTML>

      Mit freundlichen Grüßen/Regards
      Chris Peto
      Freelance System Development
      ------------------------------------
      Resource Solutions
      Höhenweg 34
      63303 Dreieich - Götzenhain
      Germany
      Mobile: +49 (0) 173 308 7843
      Tel:+49(0) 6103 80 21 98
      Web: http://www.resource-solutions.de
      mailto:CPeto@...
      ------------------------------------
      Member of: SPARK - SVG Programmers' Application Resource Kit
      http://www.schemasoft.org/






      -----Original Message-----
      From: jing_feng1977 [mailto:steven@...]
      Sent: Donnerstag, 17. Juli 2003 07:02
      To: svg-developers@yahoogroups.com
      Subject: [svg-developers] help. inline svg problem


      hi guys:
      I've tried to use inline svg to embed an svg image in the html file
      but I also need to access the svg document. it just won't work.
      anyone could help? ?? thanks a lot in advance!!!

      here is da code:
      <HTML xmlns:svg="http://www.w3.org/2000/svg">
      <object id="AdobeSVG"
      CLASSID="clsid:78156a80-c6a1-4bbf-8e6a-3cd390eeb4e2">
      </object>
      <?import namespace="svg" implementation="#AdobeSVG"?>
      <HTML>
      <!-- Copyright 2000 Adobe Systems. You may copy, modify,
      and distribute this file, if you include this notice and
      do not charge for the distribution. This file is provided
      "AS-IS" without warranties of any kind, including any
      implied warranties.
      -->
      <HEAD>

      <SCRIPT language=JavaScript>
      function init(){

      SVGPlugin = document.getElementById("AdobeSVG");

      SVGRoot = SVGPlugin.getSVGDocument();

      alert(SVGRoot);

      }
      </SCRIPT>
      <TITLE>Stars and Stripes</TITLE>
      </HEAD>
      <BODY BGCOLOR="#EEEEEE" onclick="init()">
      <H1>Animated SVG Example</H1>
      <svg:svg width="400" height="240" viewBox="0 0 1000 600">
      <svg:g transform="translate(10 60)">
      <svg:defs>
      <svg:rect id="r" width="900" height="40"
      style="fill:#dd0000" shape-rendering="optimizeSpeed"/>
      <svg:rect id="w" width="900" height="40"
      style="fill:white" shape-rendering="optimizeSpeed"/>
      <svg:polygon id="s" style="fill:white;fill-
      rule:nonzero;"
      points="0,-14 8.229,11.326 -13.315,-4.326
      13.315,-4.326 -8.229,11.326">
      <svg:animateTransform
      attributeName="transform" type="rotate" values="0;360" dur="3s"
      repeatDur="indefinite" />
      </svg:polygon>
      <svg:g id="6">
      <svg:use xlink:href="#s" x="20"/>
      <svg:use xlink:href="#s" x="90"/>
      <svg:use xlink:href="#s" x="150"/>
      <svg:use xlink:href="#s" x="210"/>
      <svg:use xlink:href="#s" x="270"/>
      <svg:use xlink:href="#s" x="330"/>
      </svg:g>
      <svg:g id="5">
      <svg:use xlink:href="#s" x="60"/>
      <svg:use xlink:href="#s" x="120"/>
      <svg:use xlink:href="#s" x="180"/>
      <svg:use xlink:href="#s" x="240"/>
      <svg:use xlink:href="#s" x="300"/>
      </svg:g>
      </svg:defs>
      <svg:use xlink:href="#r"/>
      <svg:use xlink:href="#w" y="40"/>
      <svg:use xlink:href="#r" y="80"/>
      <svg:use xlink:href="#w" y="120"/>
      <svg:use xlink:href="#r" y="160"/>
      <svg:use xlink:href="#w" y="200"/>
      <svg:use xlink:href="#r" y="240"/>
      <svg:use xlink:href="#w" y="280"/>
      <svg:use xlink:href="#r" y="320"/>
      <svg:use xlink:href="#w" y="360"/>
      <svg:use xlink:href="#r" y="400"/>
      <svg:use xlink:href="#w" y="440"/>
      <svg:use xlink:href="#r" y="480"/>
      <svg:rect id="b" width="360" height="280"
      style="fill:#000088" shape-rendering="optimizeSpeed"/>
      <svg:rect id="border" width="900" height="520"
      style="fill:none;stroke:black;stroke-width:0.85"/>
      <svg:g transform="translate(4.5 0)">
      <svg:use xlink:href="#6" y="20"/>
      <svg:use xlink:href="#5" y="50"/>
      <svg:use xlink:href="#6" y="80"/>
      <svg:use xlink:href="#5" y="110"/>
      <svg:use xlink:href="#6" y="140"/>
      <svg:use xlink:href="#5" y="170"/>
      <svg:use xlink:href="#6" y="200"/>
      <svg:use xlink:href="#5" y="230"/>
      <svg:use xlink:href="#6" y="260"/>
      </svg:g>
      </svg:g>
      </svg:svg>
      </HTML>



      Yahoo! Groups Sponsor
      ADVERTISEMENT




      -----
      To unsubscribe send a message to:
      svg-developers-unsubscribe@yahoogroups.com
      -or-
      visit http://groups.yahoo.com/group/svg-developers and click "edit my
      membership"
      ----

      Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.


      [Non-text portions of this message have been removed]
    Your message has been successfully submitted and would be delivered to recipients shortly.