Search
Recommended Sites
Related Links






Valid XHTML 1.0 Transitional

Valid CSS!
   

Informative Articles

Improve Your Visitors Experience - Add Scripts to Your Website
For new webmasters, adding third-party software and scripting to a website can be a really scary proposition. I remember when I put my first scripts on my own website. Even with my basic dos programming experience in high school, I was still...

Make a Search Engine For Your Website With PHP
This hands on PHP Programming article provides the knowledge necessary to design and develop a search engine for your website using PHP version 4.0 and above. Making a search engine for your website with PHP is really easy and provides...

One Ebook Equals 400 links
Give or take another hundred, that is. I have to admit, I love PDF ebooks. They look great, you can print them from your computer, and you can read them on any operating system. But there is also an advantage to .exe ebooks that only a few people...

Sins of The Internet: Mousetraps (and worse)
One common unethical web technique is called mouse trapping, which is often used in conjunction with another highly immoral practice called page jacking. In it's simplest form, mouse trapping merely consists of redefining the back function so...

Ten Fatal Mistakes That Make Web Sites Stink
Since you'll spend lots of time and money to create your web site, don't you want to make sure you're not making mistakes that at best irritate users, and at worst make you lose customers? After all, when you alienate users, you lose potential...

 
Using External JavaScript Files

When you have lots of JavaScript functions and you plan to use
them on many web pages, it is always advisable to keep them in a
separate file, and then include that file on every page where
those functions are required. This way, you can better organize
them, you don't have to copy/paste the code again and again
(imagine if it runs to 100 or more lines!!), and you'll be forced
to write more generalized code for better integration and
scalability.

Besides, enclosing the common JavaScript routines in external
files keeps your web pages uncluttered and search engine spiders
and crawlers are able to reach the important content easily. They
don't have to shuffle through tens of lines of scripts.

In the first edition [that appeared in my newsletter - BYTESWORTH
REACHOUT] of my article I had omitted the process of creating the
external JavaScript files, but when one of my readers asked me
how to do it, I had to re-write the article.

It's very simple. Use any text editor of your liking (if you
hand-code your HTML, you can use the same editor that you use for
your HTML editing). Write the required code, and save the file
with .js (dot js) extension.

I'm going to give you a small example.

Suppose your JavaScript file is "myjfuncs.js".

and it has a function to return the bigger number of the two
supplied as parameters (you can simply start with the function,
no need to write

So when we use one of its functions in a JavaScript:



In this way, we can use all the complex functions contained in
the myjfuncs.js file.

About the Author
Amrit Hallan is a freelance web designer. For all web site
development and web promotion needs, you can get in touch with
him at amrit@bytesworth.com or http://www.bytesworth.com. For
more such articles, visit http://www.bytesworth.com/articles You
can subscribe to his newsletter [BYTESWORTH REACHOUT] on Web
Designing Tips & Tricks by sending a blank email at
bytesworth-subscribe@topica.com

Sign up for PayPal and start accepting credit card payments instantly.