Board logo

標題: 超炫變色捲軸 [打印本頁]

作者: danny    時間: 2007-12-7 10:16     標題: 超炫變色捲軸

<HEAD></HEAD>區內 。
<!------------ 插入控制碼區段開始 ------------>
<SCRIPT language="JScript">
<!--

var scrollPct, prevStep, nextStep, interStep

steps = new Array();
steps[0] = new Array(128,128,128);
steps[1] = new Array(255,0,0);
steps[2] = new Array(255,255,0);
steps[3] = new Array(0,255,0);
steps[4] = new Array(0,255,255);
steps[5] = new Array(0,0,255);
steps[6] = new Array(255,0,255);
steps[7] = new Array(255,0,0);
steps[8] = new Array(255,255,255);

function newColor(chan) {
var i=Math.floor(steps[prevStep][chan]+interStep*(steps[nextStep][chan]-steps[prevStep][chan]));
return i;
}

function scrollFunk() {
scrollPct=(steps.length-1)*document.body.scrollTop/(document.body.scrollHeight-document.body.clientHeight);
prevStep=Math.floor(scrollPct);
nextStep=Math.ceil(scrollPct);
interStep=scrollPct-prevStep;
var newRGB="rgb("+newColor(0)+","+newColor(1)+","+newColor(2)+")";
var invRGB="rgb("+(255-newColor(0))+","+(255-newColor(1))+","+(255-newColor(2))+")";
if (document.body.style.scrollbarTrackColor != null) {
document.body.style.scrollbarFaceColor=newRGB;
document.body.style.scrollbarTrackColor=invRGB;
}
}

window.onscroll=scrollFunk;
//-->
</SCRIPT>
<!------------ 插入控制碼區段結束 ------------>




歡迎光臨 ihao論壇 (http://www.ihao.org/dz5/) Powered by Discuz! 6.0.0