app: javascript

Home
Up
.
 

Tripod JavaScript Library

One of the benefits of hosting our page at Tripod is that they have several Javascripts that we can customize and use on our own pages.  I have mirrored two of these scripts below.


Display the current date

You can use this script simply by highlighting it, copying it, and pasting anywhere within the BODY of your HTML.  IT displays the current date.

Sample Output:
    
<!--Place this script anywhere in a page.-->
<!--NOTE: You do not need to modify this script.-->

<SCRIPT LANGUAGE = "JavaScript">
<!--

// Array of day names
var dayNames = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");

var monthNames = new Array("January","February","March","April","May","June","July",
"August","September","October","November","December");

var dt = new Date();
var y = dt.getYear();

// Y2K compliant
if (y < 1000) y +=1900;

document.write(dayNames[dt.getDay()] + ", " + monthNames[dt.getMonth()] + " " + dt.getDate() + ", " + y);
// -->
</SCRIPT>
						

 

 
Image Rollover

An image rollover is when one image is substituted for another when the mouse passes over the image.

Example:  Put your mouse over this image:

    
<!--Place this script in the HEAD section.-->

<script language="JavaScript">



var n3 = false;
image1       = new Image();
// Place your first image within the
// quotation marks on the line below.
image1.src   = "mouse_off1.gif";
image1on     = new Image();
// Place your second image within the
// quotation marks on the line below.
image1on.src = "mouse_on1.gif"

image2       = new Image();
// Place your first image within the
// quotation marks on the line below.
image2.src   = "mouse_off2.gif";
image2on     = new Image();
// Place your second image within the
// quotation marks on the line below.
image2on.src = "mouse_on2.gif"

function on3(name)
{
    document[name].src = eval(name + "on.src");
}

function off3(name)
{
    document[name].src = eval(name + ".src");
}

n3 = true;
function on(name)
{
   if (n3)
      on3(name);
}

function off(name)
{
   if (n3)
      off3(name);
}
</script>



<!--Place this script in the BODY section.-->

<!-- Type your URL within the quotation marks below. -->
<a href="http://www.tripod.com" onmouseover="on('image1');" onmouseout="off('image1')">
<!--The image name below should correspond with the first image in the HEAD section.-->
  <img src="mouse_off1.gif" border="0" name="image1"></a>

<br><br>

<!--Type your URL in within the quotation marks below. -->
<a href="http://www.tripod.com" onmouseover="on('image2');" onmouseout="off('image2')">
<!--The image name below should correspond with the third image in the HEAD section.-->
  <img src="mouse_off2.gif" border="0" name="image2"></a>



 

 

Members can check out Tripod's entire line of these free scripts by logging in.

 

 

©2000 Harry Knight

Certain elements (software titles, search engine logos, etc.) are copyright and/or trademarks of the respective copyright owners.  Use of this material is restricted to educational use and is intended to promote both further understanding of the intellectual property discussed and, in effect, the product itself.