JS控制按钮自动切换背景颜色(可暂停) 时间:2020-05-13 人气:0 JS控制按钮自动切换背景颜色,可暂停_ <script language="JavaScript"> y=" "; function colourWrite(){ y=document.bgColor; if (document.layers) {x=document.FM.box.value} if (document.all) {x=document.all.kurt.innerHTML} r=x+=y.toUpperCase(); Wrte=r+" "; if (document.layers) { document.FM.box.value=Wrte; document.layers.kurt.document.open(); document.layers.kurt.document.write(""+Wrte+""); document.layers.kurt.document.close(); } if (document.all) document.all.kurt.innerHTML= Wrte; } </script> <script language="JavaScript"> var amount=0; function counter(){ var colourElements="0123456789ABCDEF"; var Split=colourElements.split(''); for (i=0; i < Split.length; i++) var a=Math.round(Math.random()*[i]); var b=Math.round(Math.random()*[i]); var c=Math.round(Math.random()*[i]); var d=Math.round(Math.random()*[i]); var e=Math.round(Math.random()*[i]); var f=Math.round(Math.random()*[i]); var G=Split[a]; var H=Split[b]; var I=Split[c]; var J=Split[d]; var K=Split[e]; var L=Split[f]; //stop error! if ((G == null)||(H == null)||(I == null)||(J == null)||(K == null)||(L == null)) counter(); else { var RandomColour=G+H+I+J+K+L; document.bgColor=RandomColour; amount++; TMR=setTimeout('counter()',1500) } } //--> </script> [Ctrl+A 全选 注:如需引入外部Js需刷新才能执行] 加载全部内容