<!DOCTYPE html>
<html lang="en">
<head>
<title>静夜思</title>
<meta charset="UTF-8">
<script> /*js 用法*/
var poem = "床前明月光,疑似地上霜。举头望明月,低头思故乡。"
var word = poem.split("");
function output()
{
/*var poem = "床前明月光,疑似地上霜。举头望明月,低头思故乡。"
var word = poem.split("");
错误示范*/
setTimeout(function () {
if(word.length>0)
{
var content = word.shift();
document.write(content);
output();
}
},200)
}
output();
</script>
/* <style type="text/css"> css
body
{
text-align: center;
}
h1
{
color: red;
}
</style>
*/
</head><pre name="code" class="html"><body>
<h1> 静夜思 </h1>
<p> 床前明月光,疑似地上霜。</p>
<p> 举头望明月,低头思故乡。</p>
</body>
</html>