Load Javascript File after page load

function loadjsfile(filename) { var fileref = document.createElement('script'); fileref.setAttribute('type', 'text/javascript'); fileref.setAttribute('src', filename); if (typeof fileref !== 'undefined') { document.getElementsByTagName('head')[0].appendChild(fileref); } }
Used to load a JavaScript file from calling a JavaScript function. The "filename" is the link to the JavaScript file.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.