Javascript DOM CSS Style borderLeftWidth Property get

Introduction

Return the width of the left border of a <div> element:

alert(document.getElementById("myDiv").style.borderLeftWidth);

View in separate window

<!DOCTYPE html>
<html>
<body>

<div id="myDiv" style="border-left:thick solid red">This is a div element.</div>
<br>
<button type="button" onclick="myFunction()">Return the width of the left border</button>
<p id="demo"></p>
<script>
function myFunction() {/* ww w  . j  a  v a2s  .  co  m*/
  document.getElementById("demo").innerHTML = document.getElementById("myDiv").style.borderLeftWidth;
}
</script>

</body>
</html>



PreviousNext

Related