标签:style blog http io ar 2014 div cti html
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<script>
window.onload=function()
{
var oBtn=document.getElementById(‘btn‘);
var oBox=document.getElementById(‘box‘);
var oTex=document.getElementById(‘tex‘);
oBtn.onclick=function()
{
var value=oTex.value;
if(!value)
{
alert(‘请输入内容‘);
return;
};
var n=0;
setTimeout(f,rnd(60,500));
function f(){
n++;
oBox.innerHTML= value.substring(0,n)+‘<span>_</span>‘;
if(n==value.length)
{
oBox.innerHTML= value.substring(0,n);
alert(‘关‘);
}
else
{
setTimeout(f,rnd(60,500));
};
};
};
};
function rnd(n,m)
{
return parseInt(Math.random()*(m-n+1)+n);
};
</script>
</head>
<body>
<input type="button" value="aa" id="btn">
<textarea id="tex"></textarea>
<div id="box" style="width:500px;border:1px solid #000;height:500px;"></div>
</body>
</html>
标签:style blog http io ar 2014 div cti html
原文地址:http://www.cnblogs.com/moliwanzi/p/3939819.html