opensubscriber
   Find in this group all groups
 
Unknown more information…

b : batik-users@xmlgraphics.apache.org 3 August 2009 • 11:47PM -0400

Calling Javascript From Inside An Applet
by gary.belcher

REPLY TO AUTHOR
 
REPLY TO GROUP




I'm experimenting with displaying SVG documents inside a Java applet using
Batik's JSVGCanvas, and I've written an applet to display the following
simple SVG image:

<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg contentScriptType="text/javascript" width="200" height="200"
version="1.1" xmlns="http://www.w3.org/2000/svg">
<circle onmouseover="show_alert()" cx="85" cy="80" r="60" stroke="black"
stroke-width="4" fill="orange"/>
</svg>

At the moment I'm having difficulty getting the show_alert() method to be
called. Every time I put my mouse over the circle I get a message telling
me that "show_alert() is not defined". I'm guessing this is because my SVG
document and/or applet doesn't know about the show_alert() method inside
of the HTML document. It works fine if I:

1. Inline the show_alert() method inside the SVG itself or point the SVG
to an external script (e.g. <script type="text/ecmascript"
xlink:href="functions.js"/>).
2. Forget the applet and use a browser that supports SVG (e.g. Firefox).
3. Use the Adobe SVG Viewer.

I don't really want to use any of those, though - I'd like to be able to
access my function in the HTML document. Is there any way of doing this
using Batik?



---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlg...
For additional commands, e-mail: batik-users-help@xmlg...

Bookmark with:

Delicious   Digg   reddit   Facebook   StumbleUpon

Related Messages

opensubscriber is not affiliated with the authors of this message nor responsible for its content.