代码示例:(标识:dhtm_typewriter)
<html>
<head>

<script type="text/javascript">
message="最好的学习方法,是学习实例。-www.sou-xun.com"
pos=0
maxlength=message.length+1

function writemsg()
{
if (pos<maxlength)
	{
	txt=message.substring(pos,0)
	document.forms[0].msgfield.value=txt
	pos++ 
	timer=setTimeout("writemsg()", 50)
	}
}
function stoptimer()
{
clearTimeout(timer)
}
</script>
</head>

<body onload="writemsg()" onunload="stoptimer()">
<form>
<input id="msgfield" size="65">
</form>
</body>
</html>
运行结果: