input标签没有.innerHTML, 所以用.value, 上代码:
<html>
<body>
<input type="text" id="testId" />
<script>
document.getElementById("testId").value = "hello";
</script>
</body>
</html>
而对于很多标签, 没有value, 此时需要用.innerHTML, 看代码:
<html>
<body>
<div id="testId">
world
</div>
<script>
document.getElementById("testId").innerHTML="hello";
</script>
</body>
</html>
再如:
<html>
<body>
<p id="testId">
world
</p>
<script>
document.getElementById("testId").innerHTML="hello";
</script>
</body>
</html>