软件教程

可以定时的页面变色脚本代码

来源: 本站    类别: 软件教程    日期: 2016/9/1

 

<SCRIPT>
function cols(c1, c2, c3, c4, c5, c6, c7){
 this.c1 = c1;
 this.c2 = c2;
 this.c3 = c3;
 this.c4 = c4;
 this.c5 = c5;
 this.c6 = c6;
 this.c7 = c7; }
rainbow = new cols("red", "orange", "yellow", "green", "blue", "indigo", "violet");
fade = new cols("white", "DDDDDD", "BBBBBB", "999999", "777777", "555555", "333333", "black");
greens = new cols("darkgreen", "forestgreen", "green", "lawngreen", "lightgreen", "limegreen", "palegreen");
sunset = new cols("skyblue", "slateblue", "violet", "darkorange", "red", "darkred", "black");
function cycle(type){

 scheme = type;

 document.bgColor = scheme.c1;

 timerID=setTimeout('document.bgColor = scheme.c2', document.selector.interval.value * 10);

 timerID=setTimeout('document.bgColor = scheme.c3', document.selector.interval.value * 20);

 timerID=setTimeout('document.bgColor = scheme.c4', document.selector.interval.value * 30);

 timerID=setTimeout('document.bgColor = scheme.c5', document.selector.interval.value * 40);

 timerID=setTimeout('document.bgColor = scheme.c6', document.selector.interval.value * 50);

 timerID=setTimeout('document.bgColor = scheme.c7', document.selector.interval.value * 60); }

 

</SCRIPT>
<FORM NAME="selector">
请选择你的变色方案:

<INPUT TYPE="button" VALUE="五彩缤纷" onClick="cycle(rainbow)">

<INPUT TYPE="button" VALUE="黑白渐变" onClick="cycle(fade)">

<INPUT TYPE="button" VALUE="绿色系列" onClick="cycle(greens)">

<INPUT TYPE="button" VALUE="日落西山" onClick="cycle(sunset)">
 


自定义变色间隔(单位:1/10秒):

<INPUT TYPE="text" SIZE="8" NAME="interval" VALUE="50">

 

</FORM>


相关文章


Copyright © 2004 - 2024 CNHWW Inc. All Rights Reserved
石家庄市征红网络科技有限公司版权所有 邮政编码:050051
服务电话:0311-85315152 13931185013 在线客服QQ:81447932 / 81447933 邮箱: cnhww@163.com