How to include Javascript from anonther ?

Actually there is such a function in PHP which function is “include”.
It’s very strong function.

But Javascript does not support such a function.

Here’s the alternate method to do that.

To include javascript, following is using usually:

<script type=”text/javascript” src=”the_script.js”></script>

But above script is not available in Javascript so following is the alternate method to include another javascript.

the_another_javascript.js:

document.write( “<script type=\”text/javascript\” src=\”the_script.js\”></script>”);

Isn’t it simple ?

Actually the main logic above is writing script tag in the document.

Leave a Reply

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