Rotating Text Banners: The Entire Code - Doc JavaScript
The Entire Code
<HTML>
<HEAD>
<TITLE>Title Here</TITLE>
<SCRIPT LANGUAGE="JavaScript1.2">
<!--
var NS4 = (document.layers) ? 1 : 0;
var IE4 = (document.all) ? 1 : 0;
onload = start;
var ar = new Array();
ar[0] = "<STRONG>Hot sites:</STRONG> <A HREF='/js/'> -->
Doc JavaScript</A>";
ar[1] = "<STRONG>Hot sites:</STRONG> <A HREF='/dhtml/'> -->
Dynamic HTML Lab</A>";
ar[2] = "<STRONG>Hot sites:</STRONG> <A HREF='/3d/'> -->
3D Animation Workshop</A>";
var num = 0;
function start() {
setInterval("update()", 2000);
}
function update() {
display("banner", ar[num]);
num++;
if (num == ar.length) num = 0;
}
function display(id, str) {
if (NS4) {
with (document[id].document) {
open();
write(str);
close();
}
} else {
document.all[id].innerHTML = str;
}
}
// -->
</SCRIPT>
</HEAD>
<BODY>
.
.
.
<SPAN ID="banner" STYLE="position: absolute;"><I>the banner -->
is loading</I></SPAN><BR><BR>
.
.
.
</BODY>
</HTML>
Created: September 25, 1997
Revised: April 16, 1998
URL: https://www.webreference.com/js/column3/code1.html