Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

Sean Harvell sean.harvell.ws

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS 

Simple JS Include function

// Simple JS Include function... add a root.js to the base lib directory...

function $include(path)
{
var x, base, src = "root.js", scripts = document.getElementsByTagName("script");
for (x=0; x<scripts.length; x++){if (scripts[x].src.match(src)){ base = scripts[x].src.replace(src, "");break;}}
document.write("<" + "script src=\"" + base + path + "\"></" + "script>");
}
« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS