Loading ...
Sorry, an error occurred while loading the content.

Batik and external ECMAScript

Expand Messages
  • Praveen Nayak
    I am using the Batik viewer inside an applet, and loading an SVG document. I have an ECMAScript method say manipulate() inside the svg file to manipulate the
    Message 1 of 2 , Jan 4, 2007
    • 0 Attachment
      I am using the Batik viewer inside an applet, and loading an SVG
      document. I have an ECMAScript method say 'manipulate()' inside the
      svg file to manipulate the svg content.

      I want to be able to call 'manipulate()' from a javascript method
      outside the svg file.

      So, the HTML could be something like this:


      <HTML>
      <HEAD>
      <SCRIPT language="ECMAScript">
      manipulateCaller()
      {
      manipulate(); // This would be the
      method inside the SVG File.
      }
      </SCRIPT>
      </HEAD>
      <BODY>
      <Applet... <!--the applet containing batik viewer,
      which inturn holds the svg document.-->
      </BODY>
      </HTML>


      Is there a way this can be done?
    • Martin Honnen
      ... JavaScript in the HTML document can access the applet element with e.g. document.applets[0] or if you give the applet a name e.g.
      Message 2 of 2 , Jan 5, 2007
      • 0 Attachment
        --- In svg-developers@yahoogroups.com, "Praveen Nayak"
        <nayak.praveen@...> wrote:
        >
        > I am using the Batik viewer inside an applet, and loading an SVG
        > document. I have an ECMAScript method say 'manipulate()' inside the
        > svg file to manipulate the svg content.


        > <Applet... <!--the applet containing batik viewer,
        > which inturn holds the svg document.-->

        JavaScript in the HTML document can access the applet element with e.g.
        document.applets[0]
        or if you give the applet a name e.g.
        <applet name="svg1" ...></applet>
        then with e.g.
        document.applets.svg1
        If the browser/Java combination supports LiveConnect then the public
        members of the applet are exposed to script meaning if the applet has
        a public method then you can script e.g.
        var applet = document.applets.svg1;
        if (typeof applet.methodName != 'undefined') {
        applet.methodName();
        }

        I don't think you can get at the script functions defined in the SVG
        document unless the applet makes sure to expose them with its public
        members.
      Your message has been successfully submitted and would be delivered to recipients shortly.