Search
Recommended Sites
Related Links






Valid XHTML 1.0 Transitional

Valid CSS!
   

Informative Articles

Absolutely an excellent way to save time in building web pages with top results
Perhaps you are tired of not knowing how to build web pages and are looking for an all in one solution. The best place to start is education. As a consumer you need to understand search engines because without any traffic all websites are...

Building a Church Website
Have you been asked to build a website for your church? Building There are thousands of people building websites everyday. It is becoming increasingly important for many small organizations and groups to build their online presence. This...

Creating Your Own HTML Email Templates in Outlook
If you want HTML Emails in Outlook to look the way YOU want, and your designing them in DreamWeaver - Heres How: Step 1 When in Outlook (Pro), Go to the Tool | Options Menu. Step 2 Click on the Mail Format Tab along the top of the current...

How to create an RSS feed
An RSS news feed can be used to communicate with your target audience. It is an ideal means of notifying people of new content on your website without the need for them to keep on visiting your site. You can send newsletters to your readership...

Web Design and Development: The Right Tools for the Right Job
Web Design and Development: The Right Tools for the Right Job As any webmaster knows, designing and developing a website can be a daunting proposition. There are millions of websites out there to compete with, and whether your site's...

 
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.