語法展示:: http://home.graffiti.net/lhuytyfr/
請用IE6.0或更新版本觀看語法特效展示
將以下程式碼複製,貼在<head>及</head>標籤之間。
<script language="JavaScript">
<!--
var scrollPct, prevStep, nextStep, interStep
steps = new Array();
steps[0] = new Array(255,0,0);
steps[1] = new Array(255,128,0);
steps[2] = new Array(255,255,0);
steps[3] = new Array(0,255,0);
steps[4] = new Array(0,0,255);
steps[5] = new Array(128,0,255);
steps[6] = new Array(255,0,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>
在 steps[0] = new Array(255,0,0); 中自行修改喜愛的顏色
留言列表