仿MSN的弹出代码(在新浪看到过这样的特效) dn001 2009-06-21 08:23:01 <!-- http://www.knowsky.com --> <!-- bbs http://www.knowsky.com/bbs--> <!--第一步:把如下代码加入<head>区域中--> <!--要完成此效果需要两个步骤 第一步:把如下代码加入到<body>区域中--> <SCRIPT language=javascript><!-- 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()",3000);/*这里你可以改变时间间隔.*/ } 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> <!--第二步:把“onload="chgCol(); pingpong();"”加在<body>标记里--> <body onload="chgCol(); pingpong();">