首页 > 代码库 > JavaScript控制网页背景随机不停的变换颜色
JavaScript控制网页背景随机不停的变换颜色
<html><head><title>JavaScript控制网页背景随机不停的变换颜色_石家庄地毯网(www.sjzditan.net)</title></head><body onLoad="chgCol(); pingpong();"><script language="JavaScript"><!-- Hide from JavaScript-Impaired Browsersvar pos = 10;function initArray() { this.length = initArray.arguments.length; for (var i = 0; i < this.length; i++) { this[i] = initArray.arguments[i]; }}var col=new initArray("4b","5b","8b","8b");col[0] = "white";col[1] = "coral";col[2] = "orange";col[3] = "red";col[4] = "greenyellow";col[5] = "lime";col[6] = "turquoise";col[7] = "coral";col[8] = "blueviolet";col[9] = "violet";function chgCol() { pos++; if (pos<0||pos>9) { pos = 0; } document.bgColor = col[pos]; setTimeout("chgCol()",1000); }var yourwords = "";var buffer1=" ";var buffer2=" ";var message1=buffer1+yourwords+buffer2;var dir = "left";var speed =150;function pingpong(){if (dir == "left") { message2=message1.substring(2,message1.length)+" "; window.status=message2; setTimeout("pingpong();",speed); message1=message2; if (message1.substring(0,1) == "*") dir="right"; }else { message2=" "+message1.substring(0,message1.length-2); window.status=message2; setTimeout("pingpong();",speed); message1=message2; if (message1.substring(message1.length-1,message1.length) == "*") dir="left"; }}// --></script><br /></body></html>
JavaScript控制网页背景随机不停的变换颜色
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。