Work From Home

Index
 

 Adventure Holiday Chat rooms
 Domains
 
Fishing
 
Free ringtones Free web design  Medical science Medical supplies Movies DVD   Money /Finance    Online games  Online shopping Pathology Pharmacy PayPal Safaris      Security Sedo      Sex info Sexy singles  Travel    

 
 

 

CREATING EXTERNAL JAVASCRIPT FILES

Use external files to make your pages load faster, reduce coding errors, and increase search engine appeal

External JavaScript files are a great way to use JavaScript functions on every page and reduce space and maintenance problems. It enables you to reduce the code search engines have to crawl through and the time taken to load your pages. It's easy and anyone wanting to work from home, wisely use their domain names and set up profitable websites can do it.

Some webmakers think they can also use external JavaScript files to hide their source code because the code doesn't display when visitors use the View Source option. That might dissuade some beginning users, but more the experienced ones will simply retrieve them from their browser cache files. Thats not the real reason to use them.

We are going to use a useful JavaScript that stops web surfers stealing your pictures and photographs as a simple example.

 No Right Click Mouse Script:

  1. Open a text editor such as Notepad.
  2. Type in or cut and paste your code into the editor.

    // JavaScript Document
    <!-- 

    if (window.Event)
      document.captureEvents(Event.MOUSEUP);

    function nocontextmenu() {
      event.cancelBubble = true, event.returnValue = false;

      return false;
    }

    function norightclick(e) {
      if (window.Event) {
        if (e.which == 2 || e.which == 3) return false;
      }
      else if (event.button == 2 || event.button == 3) {
        event.cancelBubble = true, event.returnValue = false;
        return false;
      }
    }

    if (document.layers)
      document.captureEvents(Event.MOUSEDOWN);

    document.oncontextmenu = nocontextmenu;
    document.onmousedown = norightclick;
    document.onmouseup = norightclick;
    //-->

  3. Save the text file with the extension .js. For example nomouseclick.js
  4. Upload this file to your server.
  5. In your webpage head section include the following script: <script src="nomouseclick.js"
      language="javascript"
        type="text/javascript"></script
    >
  6. Now when your webpage is loaded, it will be faster than having the script in your webpage and the added bonus, viewers will not be able to download your pictures or photographs by right clicking their mouse.
  7. Check with your hosting provider if you're having trouble getting your external JavaScript files to work. Servers must be configured to serve .js files.

External files help you remove the clutter from your page. They're an easy way to create pages that are easier to write, maintain, and index. Some search engines only crawl a certain amount of a web page - if it's too big a lot of your content might never get crawled. Some search engines look for your keywords and give priority to those at the top of your page script. Search engines pay no heed to JavaScript so the space and time is wasted. Your web page is likely to rank better if the beginning of your web page is not taken up with non keyword related script. 

Your on your way to good successful website design.

Google
 

                
 
    More from domain.e-pond.info:

Copyright 2007 domain.e-pond.info. All Rights Reserved

Privacy Policy: Your privacy is important to us. No personal information is recorded in the use of this site.

 

Sitemap