HTML DOM maxHeight ÊôÐÔ
¶¨ÒåºÍÓ÷¨
maxHeight ÊôÐÔÉèÖÃÔªËØµÄ×î´ó¸ß¶È¡£
Óï·¨£º
Object.style.maxHeight=length|%
¿ÉÄܵÄÖµ
Öµ | ÃèÊö |
---|---|
length | ¶¨ÒåÔªËØµÄ×î´ó¸ß¶ÈÖµ¡£ |
% | ¶¨Òå»ùÓÚÆä°üº¬¿éµÄ°Ù·Ö±È×î´ó¸ß¶È¡£ |
ʵÀý
±¾ÀýÉèÖÃÔªËØ¿òµÄ×î´ó¸ß¶È£º
<html>
<head>
<script type="text/javascript">
function setMaxHeight()
{
document.getElementById("p1").style.maxHeight="10px";
}
</script>
</head>
<body>
<p id="p1">This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.</p>
<input type="button" onclick="setMaxHeight()"
value="Set max height" />
</body>
</html>