·您的位置: 首页 » 资源教程 » 编程开发 » JavaScript » 48、不停变换背景色

48、不停变换背景色

类别: JavaScript教程  评论数:0 总得分:0
====1、将以下代码加入HTML的<body></body>之间:

<body bgColor="#ffffff" onload="chgCol(); pingpong();">
<script language="JavaScript">
<!-- Hide from JavaScript-Impaired Browsers
var 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] = "yellow";
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()",5000);
/* Change above set to every 10 seconds (1000 = 1 sec) If
you wish to speed it up, lower the number. To slow it
down, raise the number. */
}
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>
-= 资 源 教 程 =-
文 章 搜 索
关键词:
类型:
范围:

纯粹空间 softpure.com
Copyright © 2006-2012 暖阳制作 版权所有
承接程序设计 网页设计
QQ: 15242663 (隐身在线 拒绝闲聊)  Email: faisun@sina.com

 纯粹空间 - 韩国酷站|酷站欣赏|教程大全|资源下载|免费博客|美女壁纸|设计素材|技术论坛  

百度搜索 谷歌搜索 Alexa搜索 | 粤ICP备19116064号-1