Introduction:-
Here in this tutorial I will tell you how to use an External JavaScript file, so if you have a chunk of code that will be used in multiple pages, you will have to make one Script and then call it from the pages instead of making the same code over and over again!
Solution:-
Open a Text Editor and paste the following code and save it as <<Name>>.js I named it 'External Script.js', this is just a script that will show the time but here you can insert whatever you want!!
And this code in the main HTML file:-Code:test = new Date() month = test.getMonth() month = (month * 1) + 1 day = test.getDate() year = test.getFullYear() document.write(" ",month,"/",day,"/",year," ")
Explanation:-Code:<SCRIPT SRC="External Script.js"> </SCRIPT>
Here we are just calling the External Script, instead of "External Script.js" make whatever name you named your script!Code:<SCRIPT SRC="External Script.js"> </SCRIPT>
A Preview:-
None
Conclusion:-
As Always Feedback is welcome and the full source is attached!!
I use it already and it help us to keep the code beautiful, perhaps.
And easy to integrate js into sites.
Yup I agree! I will keep your source code nice, but that would make it more easy for other users to understand it and copy it! I don't care how nice the source is, the worst the better for my site, so people wont understand it easily, the important is that I understand it!
To protect things right-click menu can be disabled and I have seen matters when I see the source of some certain websites, Firefox closes. Exit. in about 5 seconds or less.
Well the Right-Click menu thing is just stupid I know 1000 ways on how to get round thats! thats just a waste of time!
about the second.. hmm I never saw that , but lol I still can hack it its simple! Show me such website and I will show you its source... It's simple to bypass such thing!
Well that is encrypted not just hidden but nothing is 100% safe!
nice tutorial 5/5.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks