onload Event in embedded SVG not calling function in attached script. Scope Issue?
Posted
by Nick
on Stack Overflow
See other posts from Stack Overflow
or by Nick
Published on 2010-05-18T15:26:42Z
Indexed on
2010/05/18
22:50 UTC
Read the original article
Hit count: 551
Hi
So I've got an XHTML page with a script - not inline
> <script type="text/javascript"
> src="../global/js/scripts.js"></script>
and an embedded (I tried embed and object, same behavior) SVG document with a onload="CheckIfLoaded(evt)" attribute.
The problem is firefox doesn't call the CheckIfLoaded() function in scripts.js. Firebug gives me "CheckIfLoaded() is not defined" with no reference to any line numbers. I can't find any information regarding the scope of javascript functions with respect to embedded content. Curiously, it works fine in IE.
I could of course add a reference to the script into the SVG file as well but I believe that will result in the client downloading the scripts file twice and in addition I have 1000+ svg files and I'd really rather not add one line to all of them, although I suppose I could write a batch file or whatever if I have to.
Any one know more about this?
Thanks, Nick
© Stack Overflow or respective owner