HTML DOM size ÊôÐÔ
¶¨ÒåºÍÓ÷¨
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>