3个回答
展开全部
下面的代码保存为html文件就行了,好用就给点分吧,呵呵
==================================
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>天凡</title>
<style type="text/css">
#show{border:1px solid #ef3333;width:200px;height:24px;}
</style>
</head>
<body>
<div id="show"></div>
<script type="text/javascript">
var str="这儿的文字一个一个的出现来";
var len=str.length;
var i=1;
function showword(){
document.getElementById("show").innerHTML=str.substr(0,i);
i++;
if(i>len){
clearInterval("done");
}
}
var done=setInterval("showword()",500);
</script>
</body>
</html>
==================================
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>天凡</title>
<style type="text/css">
#show{border:1px solid #ef3333;width:200px;height:24px;}
</style>
</head>
<body>
<div id="show"></div>
<script type="text/javascript">
var str="这儿的文字一个一个的出现来";
var len=str.length;
var i=1;
function showword(){
document.getElementById("show").innerHTML=str.substr(0,i);
i++;
if(i>len){
clearInterval("done");
}
}
var done=setInterval("showword()",500);
</script>
</body>
</html>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询