Thursday, December 6, 2012

style.fontWeight

Properti style.fontWeight digunakan untuk menetapkan ketebalan font.

Sintaks:

obj.style.fontWeight: value;

Nilainya:

  • Constants
    normal (default), bold, bolder, lighter, 100 - 900
  • inherit

Contoh:

<HTML> <HEAD> <TITLE>style.fontWeight</TITLE> <SCRIPT TYPE="text/javascript"> function changeWeight() { document.getElementById("myp").style.fontWeight = "900"; } </SCRIPT> </HEAD> <BODY> <P ID="myp">Lorem ipsum...Lorem ipsum...Lorem ipsum...Lorem ipsum...Lorem ipsum... Lorem ipsum...Lorem ipsum...Lorem ipsum...Lorem ipsum...Lorem ipsum... Lorem ipsum...Lorem ipsum...Lorem ipsum...Lorem ipsum...Lorem ipsum... Lorem ipsum...Lorem ipsum...Lorem ipsum...Lorem ipsum...Lorem ipsum... Lorem ipsum...Lorem ipsum...Lorem ipsum...Lorem ipsum...Lorem ipsum...</P> <BUTTON TYPE="button" ONCLICK="changeWeight()">Change Weight!</BUTTON> </BODY> </HTML>