theboyhope
IS-IT--Management
Say you have this in an html page ...
And the new_js.js file contains ...
The alert will run and testing() will run when called from new_js.js but I get a "not defined" error when calling testing() from the original page.
I suppose this could be caused by one of a number of extensions I have installed for Mozilla. Can anyone reproduce the fault?
Thanks.
Code:
<head>
<script type="text/javascript">
window.onload = function () {
var el = document.createElement( "script" );
el.setAttribute( "src", "new_js.js" );
el.setAttribute( "type", "text/javascript" );
document.getElementsByTagName( "head" )[ 0 ].appendChild( el );
testing();
}
</script>
</head>
And the new_js.js file contains ...
Code:
alert ( "New stuff loaded." );
testing();
function testing() {
alert( "Testing function." );
}
The alert will run and testing() will run when called from new_js.js but I get a "not defined" error when calling testing() from the original page.
I suppose this could be caused by one of a number of extensions I have installed for Mozilla. Can anyone reproduce the fault?
Thanks.