Dynamic script import in Javascript

Step 1:Create a file named javadomain.js and paste the below code,

document.writeln("My domain is java");


Step 2:Create a file named dotnetdomain.js and paste the below code,

document.writeln("My domain is DotNet");


Step 3: Create a file named dynamicjavascript.html and pasthe the below code,

<!DOCTYPEhtmlPUBLIC"-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
<metahttp-equiv="Content-Type"content="text/html; charset=ISO-8859-1">
document.getElementById('J').src= 'javadomain.js';
var a ="File111";
document.getElementById('D').src= 'dotnetdomain.js';
var a ="File222";


In the above program we are importing the javadomain.js file for Java button and dotnetdomain.js file for DotNet button.


Thanks for reading this post………..!!!

281 total views, 1 views today

Leave a Reply

Your email address will not be published. Required fields are marked *