Accessing sjavascript in parent window from within an embedded svg

View: New views
2 Messages — Rating Filter:   Alert me  

Accessing sjavascript in parent window from within an embedded svg

by vyasvemu :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I embedded an svg document in an HTML page. One of the svg elements has a "onmouseover=toggle(evt)" event handler. If I place the "toggle(evt)" function in the top HTML page, I am getting "toggle is not defined error" in Mozilla Firefox.

If I place the "toggle" function in the svg document itself, the function is being recognized and called. However, the "toggle" function needs to fire another script in the main HTML page.

How do I access the script in parent window from within the embedded svg?

The following is not working..

    var elem = evt.target.ownerDocument.parentNode;   // returns undefined

   or
   
   var elem = evt.target.ownerDocument.contentWindow;   // returns null.

Please help !!!

Vyas Vemu


Re: Accessing sjavascript in parent window from within an embedded svg

by vyasvemu :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Sorry, typo in the "subject line". Must read as

Re: Accessing javascript in parent window from within an embedded svg

Thanks
vyasvemu


vyasvemu wrote:
I embedded an svg document in an HTML page. One of the svg elements has a "onmouseover=toggle(evt)" event handler. If I place the "toggle(evt)" function in the top HTML page, I am getting "toggle is not defined error" in Mozilla Firefox.

If I place the "toggle" function in the svg document itself, the function is being recognized and called. However, the "toggle" function needs to fire another script in the main HTML page.

How do I access the script in parent window from within the embedded svg?

The following is not working..

    var elem = evt.target.ownerDocument.parentNode;   // returns undefined

   or
   
   var elem = evt.target.ownerDocument.contentWindow;   // returns null.

Please help !!!

Vyas Vemu