Anonymous
08-08-2005, 02:37 PM
Hi there,
I have a very simple code for getURL() and parseURL() which works just fine when I run svg file as standalone page. But it does not work when I render the same svg file through webserver!
The code is:
<?xml version="1.0" standalone="no"?>
<svg width="800" height="500" xmlns="http://www.w3.org/2000/svg" onload="init(evt)">
<desc>On Click Presence </desc>
<defs>
<script type="text/ecmascript"><![CDATA[
var svgDoc;
function init(evt){
svgDoc = evt.getTarget().getOwnerDocument();
}
function go() {
getURL(somehtml.html',fn)
}
function fn(obj) {
alert("comes to fn");
var root = parseXML(obj.content, svgDoc).firstChild;
var nchild=root.lastChild;
alert("Done!!");
}
]]></script>
</defs>
<rect onclick="go(evt)" id="Box1" x="125" y="100" width="200" height="100" stroke="blue" fill="white"/>
</svg>
and the html file is:
<html>
<head>
</head>
<body>
Test
</body>
</html>
I would really appreciate it if someone can throw some light on this subject.
Thanks.
I have a very simple code for getURL() and parseURL() which works just fine when I run svg file as standalone page. But it does not work when I render the same svg file through webserver!
The code is:
<?xml version="1.0" standalone="no"?>
<svg width="800" height="500" xmlns="http://www.w3.org/2000/svg" onload="init(evt)">
<desc>On Click Presence </desc>
<defs>
<script type="text/ecmascript"><![CDATA[
var svgDoc;
function init(evt){
svgDoc = evt.getTarget().getOwnerDocument();
}
function go() {
getURL(somehtml.html',fn)
}
function fn(obj) {
alert("comes to fn");
var root = parseXML(obj.content, svgDoc).firstChild;
var nchild=root.lastChild;
alert("Done!!");
}
]]></script>
</defs>
<rect onclick="go(evt)" id="Box1" x="125" y="100" width="200" height="100" stroke="blue" fill="white"/>
</svg>
and the html file is:
<html>
<head>
</head>
<body>
Test
</body>
</html>
I would really appreciate it if someone can throw some light on this subject.
Thanks.