- From: Kiel, Paul <pkiel@sertus.com>
- Date: Mon, 22 May 2000 09:51:26 -0400
- To: www-svg@w3.org
Greetings,
I have a question in dealing with an svg doc. I am trying to do a simple
onclick with an svg image. I can get onclick to fire just fine, but the
content is problematic. In my doc, I pass text and the current node to the
function. The function fires the window, but getting the content correct is
the hangup. In IE5.5, I walk the nodes to get the content
"thisnode.firstChild.data" - and it works fine. But in IE5, I cannot seem
to walk the tree accurately. Is the dom implementation different in IE5 vs
IE5.5 - or am I off base.
(I am working with abode's svg viewer plugin - which I suppose could also be
the culprit).
Trying to hit the content of the current element, I have tried the following
in IE5 with these results:
thisnode.firstChild.data -- returns -- 'firstChild.data' is not an object
thisnode.firstChild -- returns -- undefined
thisnode -- returns -- [object]
------------- simplified source code ------------
<?xml version="1.0" encoding="utf-8"?>
<svg width="100%" height="100%">
<defs><script><![CDATA[
function someFunction(sItem1, thisnode) {
var sItem2 = thisnode.firstChild.data
var sItem3 = " Does Item 1 = Item 2 ?"
var OpenWindow=window.open("", "",
"titlebar=no,height=200,width=300,toolbar=no,scrollbars=no,menubar=no,status
=no",null);
OpenWindow.document.write("<HTML><BODY><a href=''
onClick='self.close()'>Click to close the window</a></p><u>Item 1</u>:
"+sItem1+"<p><u>Item 2</u>: "+sItem2+"<P><u>Item 3</u>:
"+sItem3+"<P></BODY></HTML>")
}
]]>
</script></defs>
<g style="stroke:black; fill:none; stroke-width:0.5">
<rect height="50" width="150" y="337.5" x="0"></rect>
<text id="hell" y="365.5" x="4" style="font-size:28;
stroke:rgb(250,0,150); fill:rgb(250,0,150)"
onclick="someFunction('someString',this)">
box A
</text>
<line x1="400" y1="190" x2="150" y2="362.5"/>
<line x1="400" y1="635" x2="150" y2="362.5"/>
</g>
<g id="s1" style="stroke:black; fill:none; stroke-width:0.5">
<rect height="50" width="150" y="165" x="400">
</rect>
<text id="s3" y="193" x="404" style="font-size:28;
stroke:rgb(250,0,150); fill:rgb(250,0,150)"
onclick="someFunction('someString',this)">
box B
</text>
<line x1="800" y1="190" x2="550" y2="190"/>
</g>
<g id="s2" style="stroke:black; fill:none;
stroke-width:0.5"><desc>this is description</desc>
<rect height="50" width="150" y="165" x="800"></rect>
<text id="s4" y="193" x="804" style="font-size:28;
stroke:rgb(250,0,150); fill:rgb(250,0,150)"
onclick="someFunction('someString',this)">
box C
</text>
</g>
</svg>
Received on Monday, 22 May 2000 09:51:07 UTC