--- In [email protected], "Martin Honnen"
<[EMAIL PROTECTED]> wrote:
>
> --- In [email protected], "maurizio.migliore"
> <maurizio.migliore@> wrote:
> 
> 
> > I have an html page containing 2 embed svg images. 
> > All (svg images and html page) contain ecmascript. 
> > 
> > Under Netscape/Mozilla: 
> > Script code in svg files doesn't view global variables defined in html
> > page. 
> > 
> > Under Internet Explorer: 
> > It's all ok! 
> > 
> > please help me. 
> 
> There is not really anything we can do for you, the Adobe SVG viewer
> does not support script access/communication between HTML and SVG when
> used with Mozilla or Netscape 7. In fact Mozilla or Netscape 7 is not
> supported at all by Adobe, using the Adobe viewer with those browsers
> might crash the browser. The reason is that the Mozilla project did
> not have an official frozen plugin API when the Adobe SVG viewer was
> implemented, so the only Netscape specific API Adobe implemented was
> Netscape 4 support.
>
Actually it can be  done but it is a bit tricky.
For example I have have an HTML doc with two SVG embeds.  The first is
a map and the other is a legend.  I need to initialize both SVG embeds
 from the HTML and I need to control the map from the legend.
First the HTML.  I set two globals:

------------------------------------
<script>

 var MapDoc;
 var LegDoc;

 function init(evt) {

 MapDoc = document.embeds[0].getSVGDocument();
 LegDoc = document.embeds[1].getSVGDocument();

 LegDoc.getElementById("minutes_local").setAttribute('transform',.. 

 SVGDoc.getElementById('Basin_230').setAttribute('fill','white');
...
</script>
-------------------------------------------

The function init is called from the onload event of the body tag of
the HTML file.  MapDoc and LegDoc gives the two embedded SVG files. 
At that point you can manipulate either SVG DOM - I set a SVG clock in
the legend to the current time  and color code the map based on
rainfall ammounts.

In the SVG documents it is a little different.  I need the legend
document to control the map document.  

In the legend file I have the following code:
-------------------------------------------
<script><![CDATA[

  var ASV = navigator.appName.indexOf("Adobe") != -1;
  var MapDoc = ASV ? self.document.embeds[0].getSVGDocument() :
parent.document.embeds[0].getSVGDocument();

 function onoff(cbx,theme) {
  legobj = document.getElementById(cbx);
  mapobj = MapDoc.getElementById(theme);

  ......

 }

]]></script>
--------------------------------------------

First a global variable is defined to see if  you are using the Adobe
plugin or not (ASV is true if you are, false if not).
Then the global MapDoc is set to the first embed depending on the
value of the ASV variable.  At this point you are ready to go. In my
example above the function onoff controls an element in the legend
document (legobj) and an element in the map document (mapobj).

When I wrote this it was working with Firefox 1.0 with the Adobe SVG
beta plugin installed in Firefox.  It works now in the native Firefox
1.5 with no plugin.

Hope this helps.
Bruce Rindahl









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

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/svg-developers/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

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