1. Adding a Refresh Page to Your
Site
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Have you ever followed a link, only
to encounter an error message that the file being requested cannot be found?
Maybe you have a page or section to your site that is no longer active.
If so, you too may be sending visitors an error message if your server
cannot find the page being requested. To solve this, when you take a page
off your site, replace it with an automatic refresh page that will send
your vistitors in the right direction. A good way to do this automatically
is to use the "Refresh" Meta Tag in the head section of the page. Here’s
what the code looks like:
<META HTTP-EQUIV="Refresh" CONTENT="5;URL=http://www./your_host.com/
your_site/your_page.html">
The number is the time in seconds
for the Refresh to begin, while the URL is the page you wish to Refresh
to. Don’t stop there, though. You should also include a direct hyperlink
to the page that visitors can click if they don’t want to wait for the
refresh action to take place.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2. Adding the Current Date to
a Page
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Looking for an easy way to add the
current date to a page? Look no further. Here’s a very simple JavaScript
that you can use to display the date as determined by the user’s browser.
The first variable can be changed to alter the way the month is displayed.
In this expample they are shortened to reduce the amount of space required.
You can edit these to display the full month name if you like. If you use
this script, remember you'll have to change the year come January 2001...
Here’s the script:
<SCRIPT LANGUAGE="JavaScript">
var monthNames = new Array(
"Jan.","Feb.","March","April","May","June","July",
"August","Sept.","Oct.","Nov.","Dec.");
var now = new Date();
document.write(monthNames[now.getMonth()]
+
" " + now.getDate() + ", " + 2000);
</SCRIPT>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3. Random Image Displays and
Links
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Want to randomly dispay images and
hyperlinks from a list? No problem, you can do it with a simple script
like the one shown here. No need to learn server-side scripting, or slow
down your pages with full-blown Java applications. The script shown below
randomly loads an image from the list you input each time a page is loaded
into a browser. This example works with two images. You can add as many
as you like. You can even add the same image twice to double its weighting.
For example, if you have two images and would like one to be shown twice
as much as the other one, simply add the preferred image twice (to total
three images in all).
Here’s the Script Code. All you have
to do is replace the variable "imagenumber" with the correct amount of
images you’re using. Be sure to label each image with its corresponding
number in the images array. Then do the same for the corresponding links.
You can also control your image attributes in the display portion of this
script, which begins with "document.write" … That’s it. Load in your info,
refresh the page and watch what happens!
<SCRIPT LANGUAGE="JavaScript">
<!-- Hide
var imagenumber = 2 ;
var randomnumber = Math.random()
;
var rand1 = Math.round( (imagenumber-1)
* randomnumber) + 1 ;
images = new Array
images[1] = "Directory/First_Image_Name.jpg"
images[2] = "Directory/Second_Image_Name.jpg"
var myimage = images[rand1]
links = new Array
links[1] = "Directory/Your_Page.html"
links[2] = "Directory/Your_Page.html"
var mylink = links[rand1]
document.write('<A HREF="' + mylink
+ '">
<IMG SRC="' + myimage + '"
width="120" height="60" VSPACE="0"
hspace="0" border="0"></a>')
// -- End Hiding -->
</SCRIPT>
--Good Luck |