文字连续出现(4)
<script language=javascript>var style=document.all;
function writeOnText(obj,str)
{
if(style)
eval(obj+'.innerHTML=str');
}
var dispStr=new Array();
dispStr[0]="欢迎光临javascript网站!"
dispStr[1]=" "
dispStr[2]="这里你可以发现很多javascript的实例!"
dispStr[3]=" "
dispStr[4]="我们将会为你介绍javascript的实际学习方式!"
dispStr[5]=" "
dispStr[6]="我们将会为你提供最好的javascript教程!"
dispStr[7]=" "
dispStr[8]="欢迎您的意见!"
dispStr[9]=" "
var overMe=0;
function txtTyper(str,idx,idObj,spObj,clr1,clr2,delay,plysnd)
{
var tmp0=tmp1= '',skip=100;
if (idx<=str.length)
{
tmp0 = str.slice(0,idx);
tmp1 = str.charAt(idx++);
overMe=0;
writeOnText(idObj, "<span class="+spObj+"><font color='"+clr1+"'>"+tmp0+"</font><font color='"+clr2+"'>"+tmp1+"</font></span>");
setTimeout("txtTyper('"+str+"', "+idx+", '"+idObj+"', '"+spObj+"', '"+clr1+"', '"+clr2+"',"+delay+","+plysnd+")",300);
}
else
{
idx=0;
init();
}
}
var p=0;
function init()
{
txtTyper(dispStr[p], 0, 'ttl0', 'ttl1', 'red', '#99FF33', 300, 0);
p++;
if (p>=dispStr.length)
p=0;
}
</script>
<DIV class=ttl1 id=ttl0></DIV>
<body bgcolor="#fef4d9" onload=init()>
[ 本帖最后由 js_friend 于 2011-6-21 23:20 编辑 ]