Programmers are usually very possessive of their code. So if you think you have written this great script in JavaScript and don't want to share it with everyone, you can hide it from the web page source using the src attribute of <script> tag.
<script type="text/javascript" SRC="my_precious_code.js"> <!-- //--> </script>
Here my_precious_code.js is the name of the file containing your JavaScript code. As evident from the src value, the file is located in the same directory as the html document. The file name can be anything you desire, however, the extension must be .js.
This method of hiding and protecting the JavaScript code is not foolproof. Though the JavaScript code is not displayed when you view the page source, smart visitors can check their cache and can find this external JavaScript file there. Also, web site grabbing programs like Go!zilla or Getright download external JavaScript files to display the web page correctly.
Page contents: Learn how to protect and hide JavaScript code from visitors by placing the JavaScript code in an external .js file and calling it with the SRC attribute of the <SCRIPT> tag.
Comments, questions, feedback... whatever!