You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by scooter <dy...@hotmail.com> on 2007/02/15 12:41:32 UTC

Embedding Javascript

Hi,

Could someone point me towards documentation or advice on the best way to
embed JavaScript events from Batik.

I currently have the code:

element.setAttributeNS(null, "onmouseout", "doSomething(evt);");

Which works fine, but obviously ties my function name into the code.

Is there a better way of doing this?

Thanks alot in advance for any tips,

Dylan
-- 
View this message in context: http://www.nabble.com/Embedding-Javascript-tf3233263.html#a8983904
Sent from the Batik - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


RE: Embedding Javascript

Posted by Dylan Browne <dy...@mango-solutions.com>.
Hi, yes I was doing it through Java, and have no restrictions on how I
implement this, so will use the event listeners instead.

Many thanks.

-----Original Message-----
From: thomas.deweese@kodak.com [mailto:thomas.deweese@kodak.com] 
Sent: 16 February 2007 11:17
To: batik-users@xmlgraphics.apache.org
Cc: batik-users@xmlgraphics.apache.org
Subject: Re: Embedding Javascript

Hi Dylan,

scooter <dy...@hotmail.com> wrote on 02/15/2007 06:41:32 AM:

> Could someone point me towards documentation or advice on the best way 
to
> embed JavaScript events from Batik.
> 
> I currently have the code:
> 
> element.setAttributeNS(null, "onmouseout", "doSomething(evt);");
> 
> Which works fine, but obviously ties my function name into the code.
> 
> Is there a better way of doing this?

   Are you doing the above from JavaScript or from Java?
If you are doing it from Java you might be better off using
'addEventListener' to register a Java Object to receive the
event.

   If it has to be handled in JavaScript I would lean towards
the above, although it might also be possible to have the
JavaScript use LiveConnect to register the functions to call with
the Java Side of things (basically you can bind a Java Object
as a global in the JavaScript environment and then JavaScript
can call Java Methods on that object).


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: Embedding Javascript

Posted by th...@kodak.com.
Hi Dylan,

scooter <dy...@hotmail.com> wrote on 02/15/2007 06:41:32 AM:

> Could someone point me towards documentation or advice on the best way 
to
> embed JavaScript events from Batik.
> 
> I currently have the code:
> 
> element.setAttributeNS(null, "onmouseout", "doSomething(evt);");
> 
> Which works fine, but obviously ties my function name into the code.
> 
> Is there a better way of doing this?

   Are you doing the above from JavaScript or from Java?
If you are doing it from Java you might be better off using
'addEventListener' to register a Java Object to receive the
event.

   If it has to be handled in JavaScript I would lean towards
the above, although it might also be possible to have the
JavaScript use LiveConnect to register the functions to call with
the Java Side of things (basically you can bind a Java Object
as a global in the JavaScript environment and then JavaScript
can call Java Methods on that object).


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org