More and more we are seeing the transition to having scripts being called from an external source (External JavaScript File .js). We shall explain, step by step howto make, upload and call an "External JavaScript File" (.js).
The first thing you will encounter when you get to a script site that wants you to add a portion of the script into an "External JavaScript File". It is usually something designated like this:
<!-- Paste this code into an external JavaScript file named: name_of_file_here.js -->
There will be some code in this area.Ok, now we know that part of the code needs to go into an "External JavaScript File". Study what is below the above designation and 9 times out of 10 times the code will tell you when it ends by the below desigination that will possibly appear as:
<!-- Paste this code into the <HEAD>* section of your HTML document.
You may need to change the path of the file. -->
<script type="text/javascript" src="name_of_file_here.js"></script>
* This may say <BODY> instead of <HEAD>. but either way, you should just paste it where it is designated to be located.
The name of the external JavaScript is only relative to the file you make and the name you call it from. In other words, you call create the file in any name you want but you must also call it by that name in order to have it work.
Now that we got that out of the way, lets get down to actually copy/cut and paste into a notepad* for the creation of the External JavaScript File.
Once you need to paste and "Save As", you should use a notepad. If you have a Notepad replacement and not using the Microsoft® Notepad, this will not work. You Need To Save it with the Microsoft® Notepad>. Reason being is quite simple. Not everyone is using the notepad replacement you are. And by uploading it in the replacement, not all systems will be able to read the external Javascript. The notepad replacement is software that is installed on the individual system (computer). Not all systems will have the installed software for the replacement notepad you may be using. (it is a good bet though that just about every system does have the Microsoft® Notepad>). This means your system will not be able to read it and the effect will not work.
That just about covers the "howto" on making and calling an external .js script. The only other thing we shall cover is if you want to generate any HTML into an external .js script, grab the below link.
We have a "Converter/Generator" that takes all the work out of hand-coding an external .js script.
[ Converter/Generator For External .js Scripts ]
For your Information:
~ In reference to making and uploading an external .js file to call from your website. Some people are not that comfortable with doing this and prefer the more traditional way of just adding (copy/cut and paste) the script (that would be the designated external .js file) into the web document itself. The problem is that the script that is earmarked to be an external .js script is not complete on its face to add diectly into the document and must be finished. If you would grab the below link, we will show you howto use the traditional copy/cut and paste method and not make use of the external .js file.
[ Traditional Copy/Cut And Paste ~ No .js Script ]
We hope our tutorial was easy to follow and we covered everything in detail. If you have any problems with this or anything else, feel free to consult our [ FAQ ] and if you can't find the answer there, [ contact us ].
[ Rate This Page ]