Search the web
Sign In
New User? Sign Up
svg-developers · SVG Developers
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Real people. Real stories. See how Yahoo! Groups impacts members worldwide.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Creating SVG elements using Javascript in MSIE + ASV   Message List  
Reply | Forward Message #55243 of 63018 |
Re: Creating SVG elements using Javascript in MSIE + ASV

--- In svg-developers@yahoogroups.com, "Kam-Hung Soh"
<kamhung.soh@...> wrote:

> I'm would like to programmatically create SVG elements using
> Javascript in MSIE + ASV.
>
> I have an SVG element embedded in an XHTML document like this:
> <svg:svg>...</svg:svg>
>
> The XHTML document is tricked up to support MSIE + ASV like this:
>
> <object id="AdobeSVG"
> classid="clsid:78156a80-c6a1-4bbf-8e6a-3cd390eeb4e2"> </object>
> <?import namespace="svg" urn="http://www.w3.org/2000/svg"
> implementation="#AdobeSVG"?>

One possible way (not sure there are others) is to get the svg element
in the HTML DOM that IE implements, then access the SVG DOM document
the Adobe plugin implements and then simply use the W3C DOM Level 2
createElementNS the SVG DOM document implemented by Adobe provides,
e.g. if you have

<div>
<svg:svg width="200px" height="200px"
id="svg1">
<svg:circle cx="100" cy="100" r="30" fill="green" />
</svg:svg>
</div>

then you can do

var svgElement = document.getElementById('svg1');
if (svgElement != null && typeof svgElement.getSVGDocument !=
'undefined') {
var svgDocument = svgElement.getSVGDocument();
var rect =
svgDocument.createElementNS('http://www.w3.org/2000/svg', 'rect');
rect.setAttributeNS(null, 'x', '30');
rect.setAttributeNS(null, 'y', '30');
rect.setAttributeNS(null, 'width', '20');
rect.setAttributeNS(null, 'height', '20');
rect.setAttributeNS(null, 'fill', 'blue');
svgDocument.documentElement.appendChild(rect);
}






Wed Apr 12, 2006 1:59 pm

honnen_martin
Offline Offline
Send Email Send Email

Forward
Message #55243 of 63018 |
Expand Messages Author Sort by Date

Hi, I'm would like to programmatically create SVG elements using Javascript in MSIE + ASV. I have an SVG element embedded in an XHTML document like this: ...
Kam-Hung Soh
khsoh_au
Offline Send Email
Apr 12, 2006
1:44 am

... One possible way (not sure there are others) is to get the svg element in the HTML DOM that IE implements, then access the SVG DOM document the Adobe...
Martin Honnen
honnen_martin
Offline Send Email
Apr 12, 2006
2:01 pm

Hi Martin, Your tip works! Now my document will work for Firefox, Opera and MSIE + ASV. Thanks! -- Kam-Hung Soh http://kamhungsoh.blogspot.com - It Mostly...
Kam-Hung Soh
khsoh_au
Offline Send Email
Apr 17, 2006
8:04 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help