W3C home > Mailing lists > Public > www-svg@w3.org > May 2000

re: handling svg events in parent html document

From: Bernd Grolig <Bernd.Grolig@ptv.de>
Date: Fri, 26 May 2000 09:01:42 +0200
Message-ID: <81CE335DFC44D311BEFF00E0292A346ED492FC@ptv_nt_09.ptv.ptv.de>
To: www-svg@w3.org
Hi,

>In a message 'Accessing the SVG DOM from HTML' a description is given on
how to access SVG from
>HTML, where the SVG is in an embedded object. In my application I want to
do the opposite: handle an SVG
>event in the parent HTML code, or call a parent HTML/Javascript method in
an SVG event handler. 
>

You can use eventhandlers in SVG just the way You use them in HTML:

For example
<g id='b1' class='bund' onmouseover="return MyFunction('MyParameter');">

would call a Javascript function MyFunction with the parameter MyParameter.
This function may be implemented in the Javascript code of Your surrounding
HTML.
Concerning the SVG-DOM, you are able to read and manipulate the style,
location and some other information, related to the object type. You have a
variety of eventhandlers, that you might use to access the Javascript
function.

There also exists a very good tutorial on the Adobe Website. You will find
Javascript code that may give you some ideas.
http://beta1.adobe.com/svgpreview_alpha/SVG/

Regards, Bernd.
Received on Friday, 26 May 2000 03:01:44 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 5 November 2012 23:52:47 GMT