moliwanzi

打字机慢版

<!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>
</head>

<body>
<script language="JavaScript">

function do_submit()
{
var count = 0;
var str=document.getElementById("shuru").value;
var num=parseInt(Math.random()*10)
//alert (num)
var timer = setInterval(function(){
document.getElementById("shuchu").value=str.substring(0,count+num);
count++;
if(count >= str.length){
clearInterval(timer);
}
}, 1000);
}

</script>
<p>
<input name="" type="button" onClick="do_submit()" value="提交" /></button>
<input value="" id="shuru"/>
</p>
<p>
<textarea name="textfeld" id="shuchu" cols="" rows="" readonly="readonly" ></textarea>
</p>
</body>
</html>

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2021-12-19
  • 2021-09-07
  • 2021-06-19
  • 2022-12-23
  • 2021-08-26
  • 2021-08-24
  • 2021-07-17
猜你喜欢
  • 2021-06-03
  • 2022-12-23
  • 2021-04-27
  • 2021-08-23
  • 2021-11-24
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案