Javascript DOM CSS Style tableLayout Property get

Introduction

Return the table layout:

alert(document.getElementById("myTable").style.tableLayout);

Click the button to return the value of the table-layout property.

View in separate window

<!DOCTYPE html>
<html>
<head>
<style>
table, td {
  border: 1px solid black;
}

#myTABLE {//from w ww . j  a  v a2  s .  c  o m
  width: 100%;
}
</style>
</head>
<body>
<table id="myTABLE" style="table-layout:fixed;">
  <tr>
    <td>1000000000000000000000000000</td>
    <td>10000000</td>
  </tr>
  <tr>
    <td>CSS</td>
    <td>HTML</td>
  </tr>
  <tr>
    <td>Java</td>
    <td>C++</td>
  </tr>
</table>
<br>

<button type="button" onclick="myFunction()">Return table layout</button>

<p id="demo"></p>


<script>
function myFunction() {
  document.getElementById("demo").innerHTML = document.getElementById("myTABLE").style.tableLayout;
}
</script>

</body>
</html>



PreviousNext

Related