Include another JavaScript file


/ Published in: JavaScript
Save to your folder(s)

Get one javascript file to include other required javascript files.
Usefull when externalising blocks of code from html
(Found at linked URL)


Copy this code and paste it in your HTML
  1. function IncludeJavaScript(jsFile)
  2. {
  3. document.write('<script type="text/javascript" src="'
  4. + jsFile + '"></scr' + 'ipt>');
  5. }
  6. IncludeJavaScript('my_2nd_file.js');

URL: http://www.cryer.co.uk/resources/javascript/script17_include_js_from_js.htm

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.