I'm trying to modify some inline SVG with JavaScript.  It works great
in Firefox, but fails in IE.

Here is a sample JavaScript function:

function addCircle(x,y,radius,color,id) {
        if (typeof svg.svgDocument.createElementNS != "undefined") {
                var circleElem =
svg.svgDocument.createElementNS('http://www.w3.org/2000/svg', 'circle');
        } else {
                var circleElem = svg.svgDocument.createElement('svg:circle');
        }
        circleElem.setAttribute("fill-opacity", "0.7");
        circleElem.setAttribute("stroke", "black");
        circleElem.setAttribute("stroke-width", "0.1cm");
        circleElem.setAttribute("cx", x);
        circleElem.setAttribute("cy", y);
        circleElem.setAttribute("r", radius);
        circleElem.setAttribute("fill", color);
        circleElem.setAttribute("id", id);

    svg.baseNode.appendChild(circleElem);
}

where the 'svg' object in the above code is supposed to be created in
an initialize method executed by the SVG onload event.  
In Firefox, this works and 
svg.svgDocument = onloadEvent.target.ownerDocument;  
In IE the SVG onload event doesn't happen, so I initialize it during
the HTML page onload event as:
svg.svgDocument =
document.getElementById("svgBase").ownerDocument.AdobeSVG.document;
(where 'svgBase' is a 'g' node identified in the SVG).  

My inline SVG is seeded with a circle element to look for differences.
 By utilizing FireBugLite, I determined a key difference, but I can't
figure out how to compensate for the problem.

If I look at the SVG contents (using the Firebug console.dirxml
function), the original seeded circle element looks like:

<circle fill="red" r="50" cy="100" cx="100" _svg_peer="[object
SVGCircleElement]"/>

while the generated circle looks like:
<circle id="redcircle" fill="red" r="100" cy="145" cx="284"
fill-opacity="0.7" stroke="black" stroke-width="0.1cm"/>

Notice the "_svg_peer" attribute.  My generated circle is not being
created as an SVGCircleElement, but just a generic object.  How can I
instruct IE (using the Adobe SVG Viewer) to construct an SVGElement?

Thanks for any help!
Steve




-----
To unsubscribe send a message to: [EMAIL PROTECTED]
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my 
membership"
---- 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/svg-developers/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/svg-developers/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Reply via email to