Active Web Hosting Logo

Using Javascript

What is JavaScript?

JavaScript is a scripting language which can be embedded into your web page to give your site extra functionality. Unlike Java, which was developed by Sun Microsystems, JavaScript does not compile code into applets. JavaScript was developed by Netscape as an extension to HTML to provide extra functionality which can be used for drop down menus, password and data input checking, special effects, games, and providing dynamic and personalized content on web pages.

What about security?

While JavaScript can be very useful, many people also turn off JavaScript capability in their web browsers for security concerns. Therefore you should keep this in mind when designing your web pages and also provide an alternate way to accomplish the same results for those who do not use JavaScript-enabled browsers. However, many sites successfully use well-written JavaScript scripts without too many problems. JavaScript can be a great addition to any web site.

The key to safe JavaScripts is writing code that doesn't access the visitor's computer directly. Web browsers also have additional features built in that may not run all JavaScripts that may pose a security risk to a visitor's computer, while allowing other JavaScripts to run successfully. Where possible, use HTML code instead of JavaScript. Use JavaScript only if you can not find an alternate way to provide a needed fuction.

Do I need programming or HTML experience in order to use JavaScript?

Generally, you will need to know how to write HTML pages in order to use JavaScript. Programming experience is also helpful. Those who have programming experience in C or C++ will have an easier time learning JavaScript. There are many tutorials online that can assist even the beginner with learning JavaScript and HTML.. Also we have a web page tutorial which can help you get started learning HTML.

How do I put JavaScript code into my HTML page?

If you want to include the actual script code within your HTML page, you can include it anywhere between the <head> and </head> tags. Here is an example:

<title>JavaScript Example</title>
<script language="Javascript" type="text/javascript">

... JavaScript Code Goes Here ...

</head> <body>

... The rest of your HTML page goes here ...


Some code will require being placed with the body of your HTML page. This means anywhere between the <body> and </body> tags. Here is an example:

<title>JavaScript Example</title>

... Some of your HTML page may go here ...

<script src="" type="text/javascript"></script>

... The rest of your HTML page goes here ...


In the above example, you'll notice there is a link in the <script> tag. This is a link to a JavaScript file which would reside on your server. This script will then appear in the web browser right where you place this script link. This often saves the time of adding this to every page. You can simply link to the file in each page. This way you can change the JavaScript code in the *.js file anytime and it will reflect in all the pages you have the <script> tag. This is useful for adding banner rotations and other rotating content, news tickers, etc. where you may change the information in the JavaScript at times.

Where can I find JavaScript code?

There are many good sites where you can obtain free, pre-written JavaScript code which you can easily copy and paste into your web page. Below is a list:

How do I write JavaScript code?

Writing JavaScript can be rather confusing for total beginners at first. It will take a lot of practice and learning. First, be sure your web browser is not set up to block JavaScripts, so that you can see the JavaScript working. However, be advised that this does not guarantee that your visitors will still see the script work as some people may have JavaScript turned off in their browser. Always provide an alternate way to do the same thing or take into account that the JavaScript's functionality may not always be present to the visitor. For example, don't count on just JavaScript to navigate through your site (such as drop down menus, etc.) In addition, provide a text link to a site map which would be text links to your entire site, or text links to pages on your site at the bottom of each page.

One way to learn JavaScript is to look at some free scripts and see how they work. There are also a good many resources which can teach you how to write your own JavaScript code. Below is a list that should help you get started:

Online Tutorials: Books:

Always remember that while JavaScript can be very useful, it's best to use it sparingly so that you can support as many of your visitors as possible. JavaScript can still be a lot of fun just the same, giving your web site extra usability, special effects, or even providing enterting games. Learning to use and even write JavaScript code is always a good skill to have.


Home - Support - Management - About Us
... Active Web Hosting, 213 N Stephanie St G318, Henderson, NV 89074 ...
(702) 449-2337