logo

Javascripts
How to Make JS Files
Linking to External .JS files

Google
Web Search Hypergurl.com



Handy Tip : The use of external js files keeps your source code clean and lean and for some, away from prying eyes who like to take code without asking.

Bookmark This Page

Making and Linking to External .js files

You can make a .js file from any normal javascript by stripping out the opening and closing tags.<script> </script>

Let me show you what I mean!

Here is a javascript for vertical scrolling text.

 

To make the above into a .js file, simply take out the first line
<script language="javascript"> and the 2 lines at the bottom;
"window onload & </script>".

Copy and paste that code into windows notepad and save it as scroller.js or whatever. Make sure when you save the file you choose "Save as type" is set to "All files".

Linking the .js file

On the page you want the scrolling text to appear place this simple code below. You can place it on as many pages as you want:



Upload both your scroller.js file and the page with that simple code on it to your webhost.

Now each time you want to change that scrolling text you only need to edit that one scroller.js file.

The best program to edit .js files with is called EditPlus. You can download it from http://www.editplus.com/download.html It's only 1 mb download. Even though it says 30 day trial it never stops working after that time.

If you want to use this vertical scrolling text script, to change the text, you open your scroller.js file in EditPlus and go to line 7. That line must have this on it: var scrollercontents='Your Text Here' Your text must be between the two ' ' and you can also insert HTML tags to choose color and links etc. You'll notice I have some text and HTML in that line already. You simply take that out and place your own in.  

Linking to external .js files saves you a lot of time and trouble.


 
 
Hypergurl Hosting
IMPROVED PLANS
FREE Domain Name
web hosting and domain registration

 
Hosting Log In
Username:
Password: Sign up

 

NEW!
Blog for Webmasters

web site design feed Website Design

 

 
Refer A Friend
Your Email
Your Name
Friends Email
Friends Name





Site design copyright 2001-2006 © hypergurl.com