在网页中经常有人使用Swish来做文本输出的打字效果其实JavaScript也能做出那样的效果按如下方法在HTML文件中加入JavaScript代码便可
第一步把如下代码加入<head>区域中
<SCRIPT LANGUAGE=JavaScript>
<! Original: Tarjei Davidsen () >
<! This script and many more are available free online at >
<! The JavaScript Source!! >
<! Begin
var max=;
function textlist() {
max=textlistargumentslength;
for (i=; i<max; i++)
this[i]=textlistarguments[i];}
tl = new textlist( 在此输入要输出的文字);
var x = ; pos = ;
var l = tl[]length;
function textticker() {
documenttickformtickfieldvalue = tl[x]substring( pos) + _;
if(pos++ == l) {
pos = ;
setTimeout(textticker() );
if(++x == max) x = ;
l = tl[x]length;
} else
setTimeout(textticker() );}
// End ></script>
第二步把如下代码加入<body>区域中
<form name=tickform>
<textarea name=tickfield rows= cols= wrap=virtual>The news will appear here when the page has finished loading</textarea></form>
第三步把<body>改为<body bgcolor=#fefd OnLoad=textticker()>
OK大功告成!