Thursday, December 6, 2012

style.borderTopWidth

Properti style.borderTopWidth digunakan untuk menetapkan lebar border atas suatu elemen.

Sintaks:

obj.style.borderTopWidth = value;

Nilainya:

  • Length
  • Constants
    thin, medium (default), thick
  • inherit

Contoh:

<HTML> <HEAD> <TITLE>style.borderTopWidth</TITLE> <STYLE TYPE="text/css"> #mydiv { width: 500px; height: 500px; margin: 0 auto; border: solid red 1px; } </STYLE> <SCRIPT TYPE="text/javascript"> function changeTopWidth() { var list = document.forms[0].listTopWidth; document.getElementById("mydiv").style.borderTopWidth = list.options[list.selectedIndex].text; } </SCRIPT> </HEAD> <BODY> <DIV ID="mydiv"></DIV> <FORM> <SELECT NAME="listTopWidth" onChange="changeTopWidth()"> <OPTION SELECTED>medium <OPTION>thin <OPTION>thick <OPTION>10px <OPTION>20px <OPTION>30px <OPTION>40px <OPTION>50px <OPTION>60px <OPTION>70px <OPTION>80px <OPTION>90px <OPTION>100px <OPTION>200px <OPTION>300px </SELECT> </FORM> </BODY> </HTML>