On 13 July 2011 13:21, gmcaulee <[email protected]> wrote:
>        <script type="text/javascript"><![CDATA[
>
>    function sayHello() {
>                alert("Hello from test.svg!!!");
>    }
>
>  // ]]></script>

It’s similar to working between an iframe and the containing document.
You can expose the function in the parent document. You can do this directly.

// the HTML - Create an object before the svg loads
var svg = {};

// test.svg - assign your function to that object
parent.svg.sayHello = function() {
       alert("Hello from test.svg!!!");
}

// Once the SVG is loaded you can call it from the HTML
svg.sayHello();

Actually looking back at my code I notice I define the object in the
parent document taking care to not overwrite it if it already exists:
var svg = svg?svg: {};

I don’t remember exactly how that might be necessary. Maybe the timing
of the loading of the svg was unreliable.

HTH

Ollie
--
@ollicle


------------------------------------

-----
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:
    [email protected] 
    [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