<SCRIPT LANGUAGE="JavaScript">
<!--
hexa = new Array(16);
for(var i = 0; i < 10; i++) hexa[i] = i;
hexa[10]="a"; hexa[11]="b"; hexa[12]="c";
hexa[13]="d"; hexa[14]="e"; hexa[15]="f";
function hex(i) {
if (i < 0) return "00";
else if (i > 255) return "ff";
else return "" + hexa[Math.floor(i/16)] + hexa[i%16];
}
function setbgColor(r, g, b) {
var hr = hex(r); var hg = hex(g); var hb = hex(b);
if (document.body) document.body.style.backgroundColor="#"+hr+hg+hb;
else document.bgColor = "#"+hr+hg+hb;
}
var sr,sg,sb,er,eg,eb,step,at;
function setBg() {
setbgColor(
Math.floor(sr * ((step-at)/step) + er * (at/step)),
Math.floor(sg * ((step-at)/step) + eg * (at/step)),
Math.floor(sb * ((step-at)/step) + eb * (at/step)));
at++;
if (at<=step) setTimeout("setBg()",5);
}
function fade(a,b,c,d,e,f,g) {
sr=a;sg=b;sb=c;er=d;eg=e;eb=f;step=g;at=1;
setBg();
}
function swtStart() {fade(ค่าสี R1,ค่าสี G1,
ค่าสี B1, ค่าสี R2, ค่าสี G2, ค่าสี B2, ตัวเลขความหน่วง);}
window.onload=swtStart;
// -->
</SCRIPT>
|