Wow, very informative answer! Merci Martin Honnen wrote:
>--- In [email protected], Darryl Watson <[EMAIL PROTECTED]> wrote: > > > >>It is possible to access a containing webpage's javascript functions >>from your SVG document thus: >> >> top.whatever_function(); >> >>Is it possible to go the other way: to access SVG javascript (or >>ECMAscript) from its parent page? If so, what are the implications of >>having inline SVG script declared as javascript or ECMAscript? >> >>I'm using IE 6 and ASV 3.03, thanks! >> >> > >If you embed an SVG document in a HTML document with IE and Adobe SVG >viewer then there is a method getWindow exposed on the embed element >object that you can call to access the window object of the viewer >which is also the global object meaning global functions are >properties of that window object. > >Example HTML: > > <embed name="svg1" > type="image/svg+xml" > src="file.svg" > width="200" height="200"></embed> > >Then script in the HTML document can do e.g. > > var svgDocument = null, svgWindow = null; > > window.onload = function (evt) { > var embed = document.embeds.svg1; > if (embed != null && typeof embed.getSVGDocument != 'undefined') { > svgDocument = embed.getSVGDocument(); > } > if (embed != null && typeof embed.getWindow != 'undefined') { > svgWindow = embed.getWindow(); > } > } > >Once that has been done you can call global functions in the SVG >document as e.g. > > if (svgWindow != null && typeof svgWindow.functionName != 'undefined') { > svgWindow.functionName(); > } > >It should not matter whether the script element in the SVG document >has type="text/javascript" or type="text/ecmascript" as long as the >viewer does not use its internal script engine. By default within IE >it uses the MS JScript engine. > > > > > > > >----- >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 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/

