<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>字符</title>
</head>
<body>
<h1>消失</h1>
<input type="text" id="jhl" />
<input type="button" value="确定" onclick="ceui()">
<br /><br /><br /><br /><br />
<script type="text/JavaScript">
function ceui() {
var j = document.getElementById("jhl").value;
document.write("<br />"+j.length);
}
</script>
</body>
</html>
document.write("<br />"+j.length);这句代码
页面加载完毕之后调用document.write的话会把文档都完全覆盖的