Forum Moderators: open
// -------- Begin Crawler.js -------------
//--------- Begin Customization ----------
var textColor = "Blue"; // may use either HexDec or alpha names
var backColor = "#00FA9A"; // MUST use HexDec, NO ALPHA NAMES!
var mode = 1; // 1 = continuous to the left -- 2 = wiperblade
var speed = 90; // lower is faster, minimum is 50;
var alignTo = "right"; // this ignored if float positioning is used
var floatTo = "bottom"; // float positioning = top, bottom or "", use lower case
var itemsInUse = 5; // this can be less than the actual number of items below
var hasLinks = true; // use false if the crawl text items are not "clickable"
var useWidth = 645; // minimum is 350 pixels, CANNOT use width %;
//--------- End Customization ---------------
//--------- Input the crawl text ------------
crawlText = new Object;
crawlText.A = "Congratulations Lakewood Rangers Divisional Champs 2004!"
crawlText.B = "Check out video highlights from the game on our web site."
crawlText.C = "Kindergarten registration begins July 10th. Make sure your child has all the required immunizations."
crawlText.D = "June is Cholesterol Awareness Month. Free screenings in your neighborhood to be announced soon."
crawlText.E = "Be kind to the environment and a good neighbor. Start recycling! All proceeds benefit the Recreation Department."
//--------- End crawl text -----------------
//----------Set crawl links-----------------
linkList = new Object;
linkList.A = "1/Test.html"
linkList.B = "1/Test.html"
linkList.C = "1/Test.html"
linkList.D = "1/Test.html"
linkList.E = "1/Test.html"
//----------End set crawl links--------------
//--------- Add more text/link items as needed, e.g., .F, .G, then change var itemsInUse ------
//--------- No further coding is necessary! -------
//--------- DO NOT EDIT BELOW THIS LINE -----------
var strLength = 0;
var pushIndex = 0;
var pullIndex = 1;
var delLength = 0;
var absStr = "";
var leftStr = Math.round((screen.width-useWidth-36)/2);
if (useWidth < 350){useWidth = 350};
if (speed < 50){speed = 50};
if (floatTo == 'top'){
alignTo = "";
absStr = "Position:Absolute;Top:1px;Left:"+leftStr+"";}
if (floatTo == 'bottom'){
alignTo = "";
if (useWidth < screen.availWidth-15)
{absStr = "Position:Absolute;Bottom:1px;Left:"+leftStr+"";}
else{absStr = "Position:Absolute;Bottom:16px;Left:"+leftStr+"";}
}
var paddingTicks = Math.round(useWidth/9.3);
var crawlSpace = "";
var colorStr = "<font class=leftPad>";
var nList = -1;
var bumpTick = 0;
var i = 0;
currItem = new Array();
for (each in crawlText){currItem[i++] = crawlText[each]}
i = 0;
linkItem = new Array();
for (each in linkList){linkItem[i++] = linkList[each]}
var xV = 0;
var saveXV = 0;
function openLink(){
if (hasLinks == true)
{
isLink = linkItem[nList];
window.open(isLink);
// or use- window.location = isLink, or window.location.replace(isLink)
}
}
function stayHome(){
nV = document.body.scrollTop;
if (xV > saveXV && saveXV!= 0){xV = saveXV};
if (floatTo == 'top'){isFloat.style.top = nV};
if (floatTo == 'bottom'){isFloat.style.top = xV+nV};
saveXV = xV;
}
window.onscroll = stayHome;
function calcBump(){
tmpVal = 0;
calc = 0;
for (i=0; i<strLength; i++)
{
if (currItem[nList].charAt(i) == ' '){tmpVal++}
}
if (tmpVal <= 5){calc = 9}
if (tmpVal > 5 && tmpVal < 9){calc = 8}
if (tmpVal >= 9 && tmpVal < 16){calc = 7}
if (tmpVal >= 16 && tmpVal < 27){calc = 6}
if (tmpVal >= 27){calc = 5}
return calc;
}
function fillCrawlspace(){
crawlSpace = colorStr;
for (i=0; i<paddingTicks; i++){crawlSpace += '*';}
crawlSpace += "</font>";
}
function startCrawl(){
if (mode == 2){iText.style.direction = "rtl"}
if (nList < itemsInUse-1){nList++} else{nList=0;}
pushIndex = 0;
pullIndex = 0;
strLength = currItem[nList].length;
bumpTick = calcBump();
iText.innerHTML = crawlSpace;
delLength = (crawlSpace.length-27 + strLength);
pushPull();
}
function pushPull(){
if (pushIndex < strLength)
{
iText.innerHTML += currItem[nList].charAt(pushIndex);
pushIndex++;
var mod = (pushIndex / bumpTick);
mod = (parseFloat(mod) - parseInt(mod));
if (mod == 0)
{
iText.innerHTML += currItem[nList].charAt(pushIndex);
pushIndex++;
}
}
else{iText.style.direction = "ltr"};
tmpStr = iText.innerHTML;
if (pullIndex < delLength)
{
var L = tmpStr.length;
if (pullIndex < paddingTicks)
{
tmpStr = tmpStr.slice(21,L);
tmpStr = colorStr+tmpStr;
iText.innerHTML = tmpStr;
}
if (pullIndex == paddingTicks)
{
tmpStr = tmpStr.slice(27,L);
iText.innerHTML = tmpStr;
}
if (pullIndex > paddingTicks)
{tmpStr = tmpStr.slice(1,L);}
iText.innerHTML = tmpStr;
}
pullIndex++;
if (pullIndex == 2){xV = isFloat.offsetTop-4;};
if (pullIndex < delLength){setTimeout("pushPull()",speed)}
if (pullIndex == delLength){startCrawl()}
}
function buildCrawlBox(){
styleStr = "<Style> .cDiv {"+absStr+";Height:26pt;Padding-Left:0px; Padding-Right:0px;Padding-Top:3px;Padding-Bottom:0px;Margin-Right:4px;Margin-Left:6px;Margin-Top:4px;Margin-Bottom:2px;Text-Indent:0px;Text-Align:none;overflow:hidden;width:"+useWidth+";Border-Top:#C0C0C0 1px solid;Border-Left:#C0C0C0 1px solid;Border-Bottom:Black 1px solid;Border-Right:Black 1px solid;background-color:"+backColor+";} .midTbl {Border:None;Padding-Left:0px;Padding-Right:0px;Padding-Top:0px;Padding-Bottom:0px;Margin-Left:0px;Margin-Right:0px;Margin-Top:0px;Margin-Bottom:0px;Text-Indent:0px;Text-Align:none;} .hldr {Padding-Right:0px;Padding-Left:0px;Padding-Top:0px;Padding-Bottom:0px;Margin-Right:0px;Margin-Left:0px;Margin-Top:0px;Margin-Bottom:0px;Text-Indent:0px;Text-Align:none;} .leftPad {Color:"+backColor+";Font-Style:normal;Letter-Spacing:normal;Font-Weight:normal;Text-Align:none;Text-Decoration:None;Text-Indent:0px;} .cBox {Line-Height:140%;Font-Style:normal;Letter-Spacing:normal;Font-Weight:normal;Text-Align:none;Text-Decoration:none;Text-Indent:0px;Font-Family:Tahoma,Arial,Veranda;Font-Size:13pt;Color:"+textColor+";Background-Color:none;Border:None;Text-Transform:none;Padding-Left:10px;Padding-Right:2px;Padding-Top:0px;Padding-Bottom:0px;Margin-Left:0px;Margin-Right:0px;Margin-Top:0px;Margin-Bottom:0px;} </Style>";
tblStr = "<Table class=hldr align="+alignTo+"><TD><DIV id=isFloat class=cDiv ><Table cellpadding=0 class=midTbl><TD id=iText class=cBox></TD></Table></DIV></TD></Table>"
document.write(styleStr);
document.write(tblStr);
if (hasLinks == true)
{
iText.onmouseover = iText.style.cursor = "pointer";
iText.onclick = openLink;
}
}
function runCrawler(){
buildCrawlBox();
fillCrawlspace();
startCrawl();
}
// ---- End Crawler.js ---------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Untitled</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<style type="text/css">
#txtScrl{position:absolute;bottom:0;height:1.8em;background:#eed;margin:.5em auto;padding:.5em;text-align:center;width:90%;}
</style>
</head>
<body>
<div id="txtScrl">
<marquee width="80%">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec eget metus in pede feugiat porttitor.
Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Praesent dui lorem,
adipiscing ac, hendrerit ut, pretium et, felis. Donec id mauris. Phasellus malesuada mollis quam. Nulla
condimentum ultricies quam. Vivamus velit ipsum, dapibus vitae, ullamcorper non, vulputate pharetra, eros.
Donec at metus. Phasellus odio lectus, gravida sit amet, placerat sagittis, convallis non, purus. Sed tincidunt
eros id augue. Etiam tempus gravida turpis.
</marquee>
</div>
</body>
</html>