asp逐个输出字符串

来源:百度知道 编辑:UC知道 时间:2024/05/13 10:11:44
如abcd,分别输出a、b、c、d

Split(str,"") . 不行的, 不能划分, 结果还是abcd

感觉用脚本实现的效果会比较好,字符一个一个出现的。类似打字机的那种效果,以下代码,保存为HTML文件,即可看到效果
-------------------------
<html>
<head>
<title>Computer Types the Words</title>
<script>
<!--
var i = 0
var showString= "This is a computer typing script, the words in this test will appear ";
function marquee(){
var stringLength= showString.length
document.show.marquee1.value= document.show.marquee1.value + showString.charAt(i)
i++
var timeID= setTimeout("marquee()",500)//500表示显示字符的速度,单位毫秒
if (i >= stringLength){
clearTimeout(timeID);
i=0;
}
}

//-->
</script>
</head>
<body onLoad= "marquee()">
<form name="show">
My Cool Script Here....<BR>
This is a computer typing script.<BR>
<textarea rows=6 cols=57 wrap="virtual" name="marquee1"></textarea>