On Apr 12, 2005 5:52 PM, Jonathan Watt <[EMAIL PROTECTED]> wrote:
> BTW, a more portable way to get the SVG document and it's global
> "window" object is to use a function like the one below from your
> HTML. Your HTML scripts should then be able to access your SVG in
> Mozilla as well, and hopefully also in Batik.
> 
> function setSVGVars()
> {
>   // create two global variables that should point to the SVG document
>   // and its window
>   window.svgdoc = null;
>   window.svgwin = null;
> 
>   // get the embed object using getElementById!
>   var embed = document.getElementById('embed_id');

In fact I should really have put in a check here to make sure the
embed object was found. Something like:

  if (!embed)
    return;

>   try {
>     // ASV doesn't allow us to test for getSVGDocument so we just have
> to call it.
>     // We should catch exceptions thrown by browers that don't support it.
>     window.svgdoc = embed.contentDocument || embed.getSVGDocument();
>   }
>   catch (e) {
>     // ignore exception and check whether svgdoc == null later
>   }
>   window.svgwin = svgdoc && svgdoc.defaultView || embed.window || null;
> }
> 
> After calling this function you should be able to access your SVG
> document using svgdoc, and access functions and variables defined in
> scripts in your SVG document using svgwin.functionOrVariableName.
> 
> If the SVG document couldn't be accessed then svgdoc will be set to
> null. If the SVG document's global "window" object couldn't be
> accessed then svgwin will be set to null.
>


-----
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/

<*> 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