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
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!
There are currently no comments to display.
Click here to add a comment
Rate this page: