Open a SVG IE

LDCV
04-19-2004, 12:49 PM
Hi, Thanks for a question I asked.

I have another question, it is about a diferent way to open a SVG in the browser, but, without storing the SVG into a file, I mean, putting or storing the SVG code into the same HTML file, and trying open it calling it with an ID. This is a sample:

---------- HTML file
<HTML>
<svg id="mySVG" width="600" height="400">
..
</svg>
<embed src='mySVG' width... height... type="image/svg-xml">
</HTML>
---------- END HTML file

I dont know how to do that. The I try to open this document in the Browser, it shows the area of the SVG but It cannot open or doesnt compile or dont use the SVG code that is in the same document.

Please, I'll be really glad to know some news about this...

ldcv_trabajo@hotmail.com

Anonymous
04-20-2004, 01:57 AM
Hi ldcv
i found this to work,but i only tested with ie 6.0 /asv 3.0.
"empty.svg" is just an emty file.
<html>
<body onload="loadSVG()">
<XML id="doc">
<svg>

<rect x="10" y="10" width="100" height="100"/>
<a xlink:href="http://www.treebuilder.de">
<circle cx="20" cy="20" r="20" fill="red"/>
</a>

</svg>
</XML>
<embed id="emb" src='empty.svg' width="600" height="600" type="image/svg-xml">
<script>
function loadSVG(){
var emb=document.embeds("emb")
var svg=document.getElementById("doc")
var svgDoc=emb.getSVGDocument()
var svgWin=emb.getWindow()
var newNode=svgWin.parseXML(svg.innerHTML,svgDoc)
svgDoc.appendChild(newNode)
}
</script>
</body>
</html>
hope it helps
Holger

 
Web mp2kmag.com
mapforums.com

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum