Is it possible to call in a .js file synchronously and then use it immediately afterward?
This isn't pretty, but it works:
');
Or
');
window.onload = function() {
functionFromOther();
};
The script must be included either in a separate tag or before window.onload().
This will not work:
');
functionFromOther(); // Error
The same can be done with creating a node, as Pointy did, but only in FF. You have no guarantee when the script will be ready in other browsers.
Being an XML Purist I really hate this. But it does work predictably. You could easily wrap those ugly document.write()s so you don't have to look at them. You could even do tests and create a node and append it then fall back on document.write().