1
姓名: <input type="text" id="myText" size="30">
2
<p>点击按钮显示文本域 size 属性的值。</p>
3
<button onclick="myFunction()">点我</button>
4
<p id="demo"></p>
5
<script>
6
function myFunction() {
7
var x = document.getElementById("myText").size;
8
document.getElementById("demo").innerHTML = x;
9
}
10
</script>