Search
Recommended Products
Related Links


 

 

Informative Articles

Design Your Logo Like a Pro
logo is the image which represents a company or its product. Its function is to create a memorable, recognizable impression on the mind of a potential client or customer. A logo is essentially at the heart of a corporate identity. So what makes...

Do You Want To Save Time With Your Web Design?
It starts off simply; a few HTML pages, a few hyperlinks, some affiliate links. Your mother is proud of her clever son. Then you install a forum, some more content, maybe consider using a Content Management System (CMS). Before you know it, you...

How To Design A Web Site
I'm not a professional web site designer and openly admit there is a lot that I don't know. But if you're a beginner I probably know more than you do, so the listen up. Rather than give a lengthy dissertation on web design I have broken it down...

How To Shop for a Web Design Firm?
While few companies can boast as we do that our first ten clients are still with us today, many companies often change Web design firms to get a new perspective on how their Web presence could look and perform. The following paragraphs serve as a...

Steps to Optimizing Your HTML Code
Your key to success in online marketing and promotion is your web site. From your title, keywords, meta tags, and text, to your over all site design, each plays a very important role when optimizing your site. If your site doesn't rank in the...

 
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