Javascript DOM CSS Style borderLeftColor Property get

Introduction

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

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

View in separate window

<!DOCTYPE html>
<html>
<body>

<div id="myDiv" style="border-left:thick solid green">This is a div element.</div>
<br>
<button type="button" onclick="myFunction()">Return left border color</button>

<p id="demo"></p>
<script>
function myFunction() {//  w  w  w.  j a  va2s  . c o m
  document.getElementById("demo").innerHTML = document.getElementById("myDiv").style.borderLeftColor;
}
</script>

</body>
</html>



PreviousNext

Related