size 属性设置或返回文本域的尺寸(以字符数计)
textObject.size=number_of_char
下面的例子提示出了文本域的尺寸:
<html>
<head>
<script type="text/javascript">
function fieldSize()
{
alert(document.getElementById("name").size)
}
</script>
</head>
<body>
<form>
Name:
<input type="text" id="name" value="Mickey Mouse" size="20" maxlength="30" />
<br /><br />
<input type="button" onclick="fieldSize()" value="Alert size" />
</form>
</body>
</html>