<html>
<body>
E-mail: <input type="email" id="myEmail" size="30">
<p>点击按钮返回 email 字段的 size 属性值。</p>
<button onclick="myFunction()">点我</button>
<p id="demo"></p>
<script>
function myFunction() {
var x = document.getElementById("myEmail").size;
document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>