You are here: irt.org | FAQ | JavaScript | Source | Q63 [ previous next ]
Within the import.html file:
<body> <script src="import1.js"> </script> <script language="JavaScript"><!-- document.write(test1()); document.write(test2()); //--></script> </body>
Within the import1.js file:
function test1() { return '<scr' + 'ipt src="import2.js">' + '<\/script>'; }
Within the import2.js file:
function test2() { return 'Hello World'; }
Note for it to work test1() must be called whilst rendering the page. If you call it after the page has rendered then it might overwrite the current document.