HTML DOM fontWeight ÊôÐÔ
¶¨ÒåºÍÓ÷¨
fontWeight ÊôÐÔÉèÖÃ×Ö·ûµÄ´Öϸ¡£
Óï·¨£º
Object.style.fontWeight=value
¿ÉÄܵÄÖµ
Öµ | ÃèÊö |
---|---|
normal | ĬÈÏ¡£¶¨Òå±ê×¼µÄ×Ö·û¡£ |
bold | ¶¨Òå´ÖÌå×Ö·û¡£ |
bolder | ¶¨Òå¸ü´ÖµÄ×Ö·û¡£ |
lighter | ¶¨Òå¸üϸµÄ×Ö·û¡£ |
|
¶¨ÒåÓÉ´Öµ½Ï¸µÄ×Ö·û¡£400 µÈͬÓÚ normal£¬¶ø 700 µÈͬÓÚ bold¡£ |
ʵÀý
±¾Àý°ÑµÚÒ»¶ÎÉèÖÃΪ´ÖÌ壺
<html>
<head>
<script type="text/javascript">
function setFontWeight()
{
document.getElementById("p1").style.fontWeight="900";
}
</script>
</head>
<body>
<p id="p1">This is an example paragraph.</p>
<p>This is another example paragraph.</p>
<input type="button" onclick="setFontWeight()"
value="Display bold text" />
</body>
</html>