| Free HTML Tutorials • CSS • Popups tutorial • Frames Tutorials • Forms Tutorials • Beginners HTML Tutorials • Advanced HTML Tutorials • JavaScripts • Free Web Page Tutorials • Free Downloads |
|
Advanced Section |
|
JAVASCRIPTS 2 |
|
|
|
|
MORE JAVASCRIPTS
Here are two more scripts you might like to try in your pages. I will repeat what I said in the previous lesson. First download the zipped Javascript files to your working folder, then alter as described. It might help to print the portion of this page that relates to the script you want to use. You will also find the four gif files you need for the banner script. The two scripts on this page are:
Make sure you keep the original safe if you are altering any part of the code - just make a copy to play with. CHRISTMAS COUNTDOWN CODE This script will countdown to Christmas Day. If you want to countdown to some other significant date, see the Alteration Tips below. This is quite a long script so when you work on it make sure you include it all. You can use this as a separate stand alone page, or make it small enough to go somewhere in an existing or new page. Here is the example: Christmas Countdown Alteration Tips Be very careful with any alterations to this script. Note the part that goes into the BODY tag & do not alter that. Make sure you retain all spaces and symbols, especially any single quotes. If you want to change it to, say, your birthday, first think of a short form, for example, for your 25th birthday, "Bd25", would do. This would be used throughout the rest of the script. Start from "// functions for Christmas 200X calculation", about halfway down the script. (Where "X" = the current year.) Change "Christmas 200X" to "Birthday 200X". Just a few lines under that, you will find " var absXmas = new Date("December 25,200X 0:0:0")". Change "absXmas" to "absBd", and "December 25" to your birth date, making sure you keep the exact same format. If the year has changed since you last used the script you must also change that. There are several instances of "Xmas" you must change within the script and one in the text outside the script. You can, of course, change the outside text to read whatever you want. Double check everything or recopy the original if it doesn't work. You can also change the graphic to something more appropriate. TIP. The excellent "Search and Replace" function in NoteTab makes all this a lot easier. See "Downloads"" for details of how to obtain it. ROTATING BANNERS No, the banners don't actually rotate like an animated gif! The rotation refers to the fact that a certain number of banners are specified in the script and they will each have a turn to be seen each time you visit or hit "Refresh" or "Reload". You'll find the example here at: Banners Alteration Tips Be careful to retain all spaces and symbols. The links under the banners will be the same colour as the other links on your page, as specified in the BODY tag. You can change a lot of stuff in this code, in fact you have to, to change the banners to your own. In the third line you must specify the number of banners - in this case it is 4. Each if (ad==1) { line must progress with each banner in the rotation. So the next banner will be if ad==2 { and so on.
You are not confined to using banners. You can use graphics, photos (jpg or gif) to create a changing view on your page. Make your own or download something appropriate from one of the many sites which offer free graphics. Just remember to keep them all about the same size. Next: Javascript 3 Advanced Index
Help
|