<HTML><HEAD>
<!--
---------------
Marquee Message
---------------
-->
<SCRIPT LANGUAGE="JavaScript"><!-- hide from old browsers
/*
THE JAVASCRIPT COOKBOOK by Erica Sadun, webrx@mindspring.com
Copyright (c)1998 by Charles River Media. All Rights Reserved.
This applet can only be re-used or modifed by license holders of the
JavaScript Cookbook CD-ROM. Credit must be given in the source
code and this copyright notice must be maintained. If you do
not hold a license to the JavaScript Cookbook, you may NOT
duplicate or modify this code for your own use.
Use at your own risk. No warranty is given or implied of the suitability
of this applet for any specific application. Neither Erica Sadun nor
Charles River Media will be held responsible for any unwanted effects
due to the use of this applet or any derivative.
*/
//------------------------Message Travel Functions-------------
// String to Shoot
var str = ""
// Shoot a Date across the Screen
function shootDate()
{
if (str == "")
{
// initialize the string
now = new Date()
str = now.toLocaleString()
}
else
{
// shoot it slowly by adding just a few spaces
str = " " + str
}
// Update the Status Bar
window.status = str
// check if we've reached the right hand part of the screen
if (str.length < 180)
{JSCTimeOutID = window.setTimeout('shootDate()',100)}
else {str = ""}
}
// Shoot a "Comet" across the Screen
function shootComet()
{
if (str == "")
{
str = "0" // initialize commet
}
if (str.length < 8)
{
str = ">)-" + str // draw tail
}
else
{
str = " " + str // shoot it
}
// Update the Status Bar
window.status = str
// Check if we've reached the right hand part of the screen
if (str.length < 150)
{JSCTimeOutID = window.setTimeout('shootComet()',100)}
else {str = ""}
}
// Shoot an Arrow across the Screen
function shootArrow()
{
if (str == "")
{
str = ">" // initialize arrowhead
}
if (str.length < 8)
{
str = "--" + str // draw arrow
}
else
{
str = " " + str // shoot it
}
// Update the Status Bar
window.status = str
// Check if we've reached the right hand part of the screen
if (str.length < 150)
{JSCTimeOutID = window.setTimeout('shootArrow()',100)}
else {str = ""}
}
<!-- done hiding --></SCRIPT></HEAD>
<BODY bgcolor="ffffff" link="0000ff" vlink="770077">
<FONT COLOR="007777"><H1><IMG SRC="../GRAFX/UTENS.JPG" WIDTH=80 HEIGHT=50
ALIGN = LEFT>Marquee #4</H1></FONT>
<BLOCKQUOTE><FONT COLOR="770000">
This script shoots a moving missile on request
from the user. Shoot any of the following missiles.
</FONT></BLOCKQUOTE>
<CENTER><FORM>
<INPUT TYPE="button" VALUE="Shoot An Arrow"
onClick="JSCTimeOutID = window.setTimeout('shootArrow()',500);">
<INPUT TYPE="button" VALUE="Shoot A Comet"
onClick="JSCTimeOutID = window.setTimeout('shootComet()',500);"><br>
<INPUT TYPE="button" VALUE="Shoot The Date"
onClick="JSCTimeOutID = window.setTimeout('shootDate()',500);">
</FORM></CENTER>
<BR><BR>
<FONT COLOR="007777"><H2>Discussion</H2></FONT>
<FONT SIZE=4>
Unlike the previous scripts, this script is initialized
from a button. When the missile has finished its flightpath,
no further timeouts are registered.
<FONT COLOR="770000"><PRE><null
>if (str.length < 150) // off the screen<br><null
> {JSCTimeOutID = window.setTimeout('shootArrow()',100)}<br><null
>else {str = ""} // just reset the string<br><null
></PRE></FONT>
</FONT>
<h5>Copyright ©1996 by Charles River Media, All Rights Reserved</h5>
</BODY>
</HTML>