Code Snippets

Share this page with your friends

You can easily use these javascript code snippets on your own web page. All you need to do is Copy & Paste. Of course, you may need to customize it to suit your own website. Full instructions are given for how to use the javascript code.

Where possible, there is a button to "See it in action", so you can decide if it will be useful on your site. Another button will allow you to "Get the code" from a small window.

Javascript: Most of the code snippets are written as javascript functions, and are designed to be unobtrusive. Consequently, the functions must be added to the page when the page loads.

To use a javascript snippet, it must be located in a seperate script file. This file should NOT contain <script> tags, as these are used only on the webpage itself. Put the script file in a seperate folder, for convenience. Once the script is so located, then it is brought onto the webpage by putting a line like this in the <head> section:

<script type="text/javascript" src="scripts/dates.js"></script>

If the script is supposed to run when the page loads, then it must be told to do so. If you only need to run one script, then add a line like this in your script file, right after the function:

window.onload = dates.js;

If more than one script needs to be run on page load, you will need to use some other way, since you can't use window.onload twice. I highly recommend Simon Willison's addLoadEvent external link function. It allows you to easily load any number of functions at once. Then you can make a script file for each webpage, make 'addLoadEvent' the first function in this file, and use it to add ALL necessary functions to your webpage when it loads.

Other useful advice: I assume that you have a website that you want to design or improve. If you don't have your site online yet, I would recommend that you sign up with a server, such as HostGo, ASAP. There's no substitute for actually trying the code on your own page.

You will need some tools to make things easier to do, such as an FTP transfer program and a text editor. Check out the Webmaster Tools page for some of the tools that I use. There are even some free ones!

About Scribe SEO

SEO Made Simple: It's as simple as 1, 2, 3:

  1. Keywords. Scribe shows you the language searchers use before you begin to write. Once your content is created, Scribe reveals other profitable keywords.
  2. Content. Scribe analyzes your natural, reader-focused content, and tells you how to gently tweak it to spoon feed search engines based on 15 SEO best practices.
  3. Links. Scribe helps you build back links, crosslink the content within your own site, and identify influential social media users who want to share your stuff.

Video: Scribe SEO in action! Download: Free SEO Whitepaper

Ads by The Professor


Comments

There are currently no comments to display.

Click here to add a comment

Rate this page:






Share this page with your friends


Snippet Menu

  • Alert Box - Email
    Form Field Required
  • Table Rows with
    Alternating Colors
  • Track Hits from
    Your Backlinks
  • Protect your MailTo
    Link from Spammers
  • Overlay Box
    Instead of Popups
  • Form Submission
    No Double-Click
  • Change Dates
    Automatically
  • Is it Standard
    or Daylight Time?
  • Same Window
    or New Window?

RSS Feeds

  • Add 'Professors Coding Corner' to my feed reader.
  • Preview Professors Coding Corner on Feedage
  • Please preview this RSS feed on FeedAg, and rate it for me.
  • Professor's Ezine Articles about Web Programming
Scribe - It's as simple as 1, 2, 3!
Professor, 7807 Lerkenlund, St. Thomas, VI 00802 Tel: 340.715.3542
Copyright ©  Professional Website Design Website by: The Professor external link About Me Accessibility Legal Site Map
Professional Website Design logo

Professor's Coding Corner

  • Home
  • Code Snippets
  • Tutorials
  • Resources
    • HTML & CSS
    • Javascript
    • Perl
    • Tools
    • Other
  • Articles
  • Contact