POSUN TEXTU

ID
Nazov / Name:
Popis / Description:
Dlzka / Length:
Testovane pod / Tested under:

 

115
p115.html / p115.zip
Efektny posun textu v stavovom riadku
1839b
NN 4.04, IE 4.0

UKAZKA / CLICK HERE

Zdrojovy tvar / Source code:

<html> <head> <title> JavaScript DESTINATION - P115 </title> </head> <SCRIPT LANGUAGE="JavaScript"> <!-- var theString = "Pozor !|" + "Tento|" + "skript|" + "|" + " sa vam urcite velmi |" + "PACI!|" + "|" var width = 125; var speed = 10; var len = theString.length; var start = 0; var end=findIndex(start); var scroll=0; var displayStr = ""; var thisStr = theString.substring(start,end-1); var thisLen = thisStr.length; var thisHalf = Math.ceil(thisLen/2); var x=0; function findIndex(x) { if (x>=len) return -1; if (theString.charAt(x) == '|') return x+1; else return findIndex(x+1); } function addSpaces(x) { for (var i=0; i<x; i++) displayStr = displayStr + " "; return true; } function doCool() { scroll+= speed; if (thisLen + 2*scroll > width) { displayStr = ""; addSpaces(scroll); displayStr = displayStr + thisStr; window.status = displayStr; start = end; end = findIndex(end); if (end!=-1) { scroll = 0; thisStr = theString.substring(start,end-1); thisLen = thisStr.length; thisHalf = Math.ceil(thisLen/2); setTimeout("doCool()",1500); } else setTimeout("doCool()",1500); } else { displayStr = ""; addSpaces(scroll); displayStr = displayStr + thisStr.substring(0,thisHalf); addSpaces(width-thisLen-2*scroll); displayStr = displayStr + thisStr.substring(thisHalf,thisLen); window.status = displayStr; setTimeout("doCool()",0); } } //--> </SCRIPT> <body onLoad="doCool(); return true;"> </body> </html>
[ Navrat / BACK ]