Forgot your password?
typodupeerror

Comment: Eh? (Score 1) 525

by Just some bastard (#24690615) Attached to: Was Standardizing On JavaScript a Mistake?

A real way to include other javascript files.

The "real" way is via the DOM.

function include(url){
var s = document.createElement("script");
s.setAttribute("type", "text/javascript");
s.setAttribute("src", url);
var nodes = document.getElementsByTagName("*");
var node = nodes[nodes.length -1].parentNode;
node.appendChild(s);
}

A well defined way to say "The page is loaded, all your variables and objects are loaded, Time to execute!" rather then "You can only see the variables and objects that are defined 'above' you and not 'below' you in unloaded portions of the page".

window.onload is the DOM event you're looking for.

Those who do not understand Unix are condemned to reinvent it, poorly. - Henry Spencer, University of Toronto Unix hack

Working...