Administrators Leon Posted August 16, 2012 Administrators Share Posted August 16, 2012 Here is a neat little javascript function to load a remote CSS or Javascript file remotely: <script> function loadjscssfile(filename, filetype) { if (filetype=="js") { var fileref=document.createElement('script') fileref.setAttribute("type","text/javascript") fileref.setAttribute("src", filename) } else if (filetype=="css") { var fileref=document.createElement("link") fileref.setAttribute("rel", "stylesheet") fileref.setAttribute("type", "text/css") fileref.setAttribute("href", filename) } if (typeof fileref!="undefined") { document.getElementsByTagName("head")[0].appendChild(fileref); } } </script> Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now