<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link href="../idea/widows.css" rel="stylesheet">
<style>
body {
background-color: #C6C6C6;
}
.outs {
width: 840px;
height: 280px;
background-color: #FFFFFF;
border-radius: 12px;
margin: 50px auto;
}
#write{
width: 338px;
height: 240px;
background-color: #EFEFD6;
float: left;
margin-top: 20px;
margin-left: 18px;
}
.inof {
float: left;
margin-top: 20px;
margin-left: 6px;
}
.inof a {
color: white;
font-size: 18px;
}
.inof .lock {
width: 110px;
height: 42px;
line-height: 42px;
text-align: center;
background-color: #F76300;
}
.inof .num {
/*background-color: #73A500;*/
text-align: center;
margin-top: 30px;
}
.inof .num p {
color: black;
font-size: 26px;
font-weight: bold;
}
.last {
width: 338px;
height: 240px;
background-color: #63EFF7;
float: right;
margin-top: 20px;
margin-right: 18px;
}
</style>
<script>
window, onload = function () {
var time = 0;
var text = document.getElementById('write');
var opens = document.getElementById('open');
var blocks = document.getElementById('block');
var spans = document.getElementById('span1');
var spanes = document.getElementById('span2');
opens.onclick = function () {
var str = text.value;
var arr = str.split('');
var array=str.split('');
var index = 0;
if (arr.length == 0) {
alert("请在左侧输入文字");
blocks.innerHTML ='';
return;
}
time = setInterval(function () {
text.value=array.join('');
array.shift();
if (index == arr.length) {
clearInterval(time);
return;
}
var num = index;
blocks.innerHTML += arr[index];
spanes.innerHTML = arr.length;
spans.innerHTML = num + 1;
index++;
}, 200)
blocks.innerHTML ='';
}
}
</script>
</head>
<body>
<div class="outs">
<textarea id="write"></textarea>
<div class="inof">
<div class="lock"><a href="#" id="open">把文字右移</a></div>
<div class="num"><p><span id="span1">0</span>/<span id="span2">0</span></p></div>
</div>
<div class="last" id="block"></div>
</div>
</div>
</body>
</html>
文字搬运工
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...