Mittach zusammen, ich hab da so einen scroller, der leider nach einem durchlauf stoppt. Flink wollte ich den umschreiben, aber ich komme nicht weiter. Die einfachste version, eine funktion zu schreiben die nach einer zeit x den scroller neu aufruft habe ich schon probiert, aber da hauts dann den internen zeit ablauf beim scroller durcheinander. Ich verstehe nicht so ganz wie der funktioniert.
Any help would be appreciated ;-)
Any help would be appreciated ;-)
PHP-Code:
<script language="JavaScript1.2" type="text/JavaScript1.2">
/* Begin HIGHLIGHT */
var idme=908601;
var convert = new Array();
var hexbase = new Array("0", "1", "2", "3", "4", "5", "6", "7",
"8", "9", "A", "B", "C", "D", "E", "F");
var value=0;
var rgb;
for (x=0; x<16; x++)
for (y=0; y<16; y++) {
convert[value] = hexbase[x] + hexbase[y];
value++;
}
var timerID = null, timerRunning = false;
function stopClock(){
if(timerRunning)
clearTimeout(timerID)
timerRunning = false
}
var layers = document.layers;
var style = document.all;
var both = layers || style;
if (layers) { layerRef = 'document.layers'; styleRef = ''; }
if (style) { layerRef = 'document.all'; styleRef = '.style'; }
function moveLayer(obj, topx, leftx) {
if (both) {
eval(layerRef + '["'+obj+'"]' + styleRef + '.top = topx');
eval(layerRef + '["'+obj+'"]' + styleRef + '.left = leftx');
}
}
/*
* COPYRIGHT(c) 1998. Teg Workz.
*
* The fadeText, hexToDex and changeColor functions is being
* made available for public BUT personal or non-profit use.
* All other functions are for the private use of the author
* and violators will be prosecuted using the full extent of
* the law. No warranty or support will be given in using
* this script and any modification to the fadeText and
* changeColor functions will void the user of any inquiries
* he/she might ask the author regarding the script.
* DO NOT REMOVE THE COPYRIGHT NOTICE
*
* Script title : Text Fader 1.3: the re-written version
* site authorized : public use w/o modification
* script created : 23 December 1997
* updated : 8/19/98 1:36PM (kewl!finished the script after 5 hours)
*
* Emmanuel C. Halos - [email]agent_teg@ThePentagon.com[/email]
*
* - "MABUHAY ang PILIPINAS!!!" -
*
* Version History :
*
* 1.00 - 1.20 : See Text Fader 1.2 - [url]http://members.tripod.com/~halos/[/url]
* 1.30 : Practically rewrote the whole script.
* Surprised that it's longer than the
* last however, the starting color and
* ending color can now be defined
* independently. (see SYNTAX below)
* Tested with NS 4.06 and IE 4 (win98)
* Unfortunately, due to some webTV limits
* it will not work with them
*
* This script is begware
*
* END OF COPYRIGHT
*/
var s1, s2, s3, s2r, s2g, s2b, smallest;
function hexToDec(hex) { var value=0; while (true) { if (convert[value] == hex) break; value++; } return value; }
function writeOn(obj, str) {
if (layers) with (document[obj]) {
document.open();
document.write(str);
document.close();
}
if (style) {
eval(obj+'.innerHTML= str');
}
}
function changeColor(obj, str, rgb1, speed, counter) {
if (counter < smallest) {
stopClock();
if (layers) with (document[obj]) { document.open(); document.linkColor = rgb1; document.fgColor = rgb1; document.write(str); document.close(); }
if (style) { eval(obj+'.document.linkColor= rgb1');
eval(obj+'.innerHTML= "<font color="+rgb1+">"+str+"<\/font>"');
// eval(layerRef + '["'+obj+'"]' + styleRef + '.color= rgb1');
}
s2r+=s1; s2g+=s2; s2b+=s3;
tempR = Math.round(s2r); tempG = Math.round(s2g); tempB = Math.round(s2b);
if (tempR <= 0) tempR = 0; if (tempG <= 0) tempG = 0; if (tempB <= 0) tempB = 0;
if (tempR >= 255) tempR = 255; if (tempG >= 255) tempG = 255; if (tempB >= 255) tempB = 255;
rgb1 = convert[tempR] + convert[tempG] + convert[tempB];
counter++;
timerID = setTimeout('changeColor("'+obj+'", "'+str+'", "'+rgb1+'", '+speed+', '+counter+')', speed);
timerRunning = true;
}
}
function fadeText(obj, str, rgb1, rgb2, speed, step) {
var r1, g1, b1, r2, g2, b2;
for (cnt=1; cnt<=2; cnt++) {
eval('r'+cnt+' = hexToDec(rgb'+cnt+'.slice(0,2));');
eval('g'+cnt+' = hexToDec(rgb'+cnt+'.slice(2,4));');
eval('b'+cnt+' = hexToDec(rgb'+cnt+'.slice(4,6));');
}
with (Math) {
s2r = r1; s2g = g1; s2b = b1;
s1 = abs(r1 - r2); s2 = abs(g1 - g2); s3 = abs(b1 - b2);
if (s1 > s2 && s1 > s3) { smallest = s1; } else if (s2 > s1 && s2 > s3) { smallest = s2; } else { smallest = s3; }
s1 = (s1 == 0) ? 0 : s1/smallest; s2 = (s2 == 0) ? 0 : s2/smallest; s3 = (s3 == 0) ? 0 : s3/smallest;
s1*=step; s2*=step; s3*=step;
if (r1 > r2) { s1 = -s1; } if (g1 > g2) { s2 = -s2; } if (b1 > b2) { s3 = -s3; }
smallest= Math.round(smallest/step);
}
if (both) { changeColor(obj, str, rgb1, speed, 0); } else { document.write("Err. for some reason you tried viewing this page with a browser that doesn`t support javascript/CSS block support"); }
}
/* END HIGHLIGHT */
function getMid() { tvAgent = navigator.userAgent; if (layers) { maxX = innerWidth; maxY = innerHeight; } if (style) { maxX = document.body.clientWidth; maxY = document.body.clientHeight; } if (tvAgent.indexOf("WebTV") != -1) { maxX = 544; maxY = 378; } midX = maxX/2; midY = maxY/2; }
function layout() { getMid(); moveLayer('fadeMe01', midY-50, midX-200);
/* fadeText SYNTAX
*
* fadeText(layerName, message, startFade(RRGGBB), endFade(RRGGBB), speed, step);
*
*/
fadeText("fadeMe01", "<div class=akt>The Supreme Way is not difficult<br> If only you do not pick and choose.<br>Neither love nor hate,And you will clearly understand.<br>Be off by a hair,<br>And you are as far from it as heaven from earth.<br>If you want the Way to appear,<br>Be neither for nor against. GASSHO</div>", "7A9A51", "D5E1C6", 10, 2);
setTimeout('fadeText("fadeMe01", "<div class=akt>News #3: Dies ist ein Fülltext, bitte geben sie ihren text hier ein! ID: S1Q0UkE4</div>", "7A9A51", "D5E1C6", 10, 2)',6111);
setTimeout('fadeText("fadeMe01", "<div class=akt>News #3: Dies ist ein Fülltext, bitte geben sie ihren text hier ein! ID: HpV1FdOZBr</div>", "7A9A51", "D5E1C6", 10, 2)',12222);
setTimeout('fadeText("fadeMe01", "<div class=akt>News #3: Dies ist ein Fülltext, bitte geben sie ihren text hier ein! ID: ScAvPAYGeN</div>", "7A9A51", "D5E1C6", 10, 2)',18333);
}
</script>
Kommentar