Thursday, December 6, 2012

style.height

Properti style.height digunakan untuk menetapkan tinggi area isi suatu elemen.

Sintaks:

obj.style.height: value;

Nilainya:

  • auto (default).
  • Length
  • inherit

Contoh:

<HTML> <HEAD> <TITLE>style.height</TITLE> <STYLE TYPE="text/css"> #mydiv { height: 200px; width: 200px; border: solid #000 1px; } </STYLE> <SCRIPT TYPE="text/javascript"> function changeHeight() { document.getElementById("mydiv").style.height = "500px"; } </SCRIPT> </HEAD> <BODY> <DIV ID="mydiv"></DIV> <BUTTON TYPE="button" ONCLICK="changeHeight()">Change height!</BUTTON> </BODY> </HTML>