Re: svg and javascript embedded in html

uddy <[email protected]> Fri, 4 Sep 2009 07:40:07 -0700 (PDT)
Newsgroups gmane.comp.mozilla.devel.svg
Organization http://groups.google.com
Message-ID <b0dc8a41-a2c0-49f2-824f-c234318c8316@c37g2000yqi.googlegroups.com>
Hi Helder,

 >1. Making an attribute to the "document" (special) variable may have
>undesired results. Consider using another variable such as "svgEle";

Actually the variable had once the name svgdoc I don't know when I
changed it or why.
But thanks for reminding me.

>  3. Best (only?) way to get a pointer to the SVG document's DOM in
> Gecko is "CONTAINER_OBJECT_DOM.contentDocument" [1].

I'm using the IE for this "project", so contentDocument doesn't work
(didn't know until i tried it today).
But the first part that tries to get an svg from an embed tag works.
With firefox both methods work of course (embed and object), but
firefox doesn't support all the features I need
(or i couldn't figure out how to get them working), the main reason
I'm using IE, however, is because
I have to integrate this code in some interface that was built for IE
only, because it needs
some ActiveX stuff (Cortona for VRML etc.).

> Summing up, you example would turn into:
>  svgDocument = document.getElementById("svg1").contentDocument;
>  svgElement = svgDocument.getElementById("elementname");

This doesn't work because IE doesn't know contentDocument(I guess),
and because svg1 is not the 'id' of the object but the 'name' and of
course it's in an embed tag
not an object tag. But I should have mentioned this before.

> I've found this paragraph to be a little confusing. Please clear [2]
> it up a if possible.

What I meant was, I have some javascript code in the svg file,
(when I click on the graphics they use onclick etc. to perform some
actions)
and now I would like to access the variables which are in the
javascript code that is in the svg file, from the html file.
I think Boris who answered after you got it.
But the problem is still this doesn't work with IE.

I should have mentioned at the start that this needs to work with the
IE,
but I didn't know that the difference between gecko and IE-engine is
so huge.
At leaset I hoped it is not.

This is how I use the svg in the html:
embed id ="bp_man" src="click_con_enhanced.svg" name="svg1"
type="image/svg-xml" height="400" width="500"

I hope someone (although it's a mozilla group) knows a solution that
works with the embed tag and not only with the object tag.

Thank you anyway for trying,

Mario