Adding JavaScript to your Pages This is very easy to do.
Usually the applets, or scripts, that you'll find include the code you'll need and also
show you where to put it. Probably 7 times out of 100 the code is going to go between the <head>
</head> tags. Others are placed in the pages themselves where they will appear.
We'll use the old TickerTape
applet as an example.
1. Open up your HTML editor with the page that you
want to add the script to. If you wrote a normal page, it should look a little like:
<html>
<head><title>Your Page Title</title>
</head>
<body>
</body>
</html>
2.Now, we want to add the code in-between the two
<head> tags. So after the < title></title> tags, copy in the code
from the script
like so:
<html>
<head><title>Your Page Title</title>
<SCRIPT LANGUAGE="JavaScript">
<!-- Beginning of JavaScript Applet -------------------
/* Copyright (C)1996 Web Integration Systems, Inc. DBA Websys, Inc.
All Rights Reserved.
This applet can be re-used or modified, if credit is given in
the source code.
We will not be held responsible for any unwanted effects due to the
usage of this applet or any derivative. No warrantees for usability
for any specific application are given or implied.
Chris Skinner, January 30th, 1996.
*/
function scrollit_r2l(seed)
{
var m1 = "one ";
var m2 = "two ";
var m3 = "three ";
var m4 = "";
var msg=m1+m2+m3+m4;
var out = " ";
var c = 1;
if (seed > 100) {
seed--;
var cmd="scrollit_r2l(" + seed + ")";
timerTwo=window.setTimeout(cmd,100);
}
else if (seed <= 100 && seed > 0) {
for (c=0 ; c < seed ; c++) {
out+=" ";
}
out+=msg;
seed--;
var cmd="scrollit_r2l(" + seed + ")";
window.status=out;
timerTwo=window.setTimeout(cmd,100);
}
else if (seed <= 0) {
if (-seed < msg.length) {
out+=msg.substring(-seed,msg.length);
seed--;
var cmd="scrollit_r2l(" + seed + ")";
window.status=out;
timerTwo=window.setTimeout(cmd,100);
}
else {
window.status=" ";
timerTwo=window.setTimeout("scrollit_r2l(100)",75);
}
}
}
// -- End of JavaScript code -------------- -->
</SCRIPT>
</head>
<BODY onLoad="timerONE=window.setTimeout('scrollit_r2l(100)',500);">
3. Now save your file with the code in place.
4. Open up your favorite Java enabled browser
(Netscape 2.0+ and Microsoft Internet Explorer 3.0+) and view the page. You should see
some text floating down at the bottom saying
"one two three".
Return Home
All Artwork &
Design © 1997-1999 Krit Spooker |