<!--要完成此效果需要两个步骤
第一步:把如下代码加入到<head>区域中-->
<script language="JavaScript1.2">
var size = 20;
var speed_between_messages=1500
var tekst = new Array()
{
tekst[0] = "朝 辞 白 帝 彩 云 间";
tekst[1] = "千 里 江 陵 一 日 还";
tekst[2] = "两 岸 猿 声 啼 不 住";
tekst[3] = "轻 舟 已 过 万 重 山";
}
var klaar = 0;
var s = 0;
var veran =0;
var tel = 0;
function bereken(i,Lengte)
{
return (size*Math.abs( Math.sin(i/(Lengte/3.14))) );
}
function motor(p)
{
var output = "";
for(w = 0;w < tekst[s].length - klaar+1; w++)
{
q = bereken(w/2 + p,16);
if (q > size - 0.5)
{klaar++;}
if (q < 5)
{tel++;
if (tel > 1)
{
tel = 0;
if (veran == 1)
{
veran = 0;
s++;
if ( s == tekst.length)
{s = 0;}
p = 0;
if (window.loop)
{clearInterval(loop)}
loop = motor();
}
}
}
output += "<font style='font-size: "+ q +"pt'>" +tekst[s].substring(w,w+1)+ "</font>";
}
for(k=w;k<klaar+w;k++)
{
output += "<font style='font-size: " + size + "pt'>" +tekst[s].substring(k,k+1)+ "</font>";
}
idee.innerHTML = output;
}
function startmotor(p){
if (!document.all)
return
var loop = motor(p);
if (window.time)
{clearInterval(time)}
if (klaar == tekst[s].length)
{
klaar = 0;
veran = 1;
tel = 0;
var time = setTimeout("startmotor(" +(p+1) + ")", speed_between_messages);
}else
{
var time =setTimeout("startmotor(" +(p+1) + ")", 50);
}
}
</script>
<div ID="idee">
</div>
<!--
第二步:把“onload="startmotor(0)"”加在<body>标记里
例如:-->
<body onload="startmotor(0)">