使用JavaScript实现文字输出的效果,输入标最后实现闪烁s效果
思想:可以定义一个白色方块,然后使它平行右移动,来显示它所掩盖的文字,最后闪烁效果使用周期定时器和单次定时器相结合。
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>定时器</title>
<style type="text/css">
body {
margin: 5px;
}
div {
color: darkgrey;
position: absolute;
left: 5px;
}
#img {
width: 200px;
height: 30px;
background-color: #ffffff;
position: absolute;
top: 1px;
left: 5px;
}
#biao {
height: 30px;
width: 2px;
background-color:black;
position: absolute;
top: 1px;
left: 5px;
}
</style>
</head>
<body>
<div>
今天是个好日子,好日子!
</div>
<div id="img"></div>
<div id="biao">