Javascript DOM CSS Style borderLeftStyle Property set

Introduction

Change the style of the left border of a <div> element to "dotted":

document.getElementById("myDiv").style.borderLeftStyle = "dotted";

View in separate window

<!DOCTYPE html>
<html>
<head>
<style>
#myDiv {/*from   w  ww.  j a  v  a2s .  co m*/
  border: thick solid #FF0000;
}
</style>
</head>
<body>

<div id="myDiv">This is a div element.</div>
<br>
<button type="button" onclick="myFunction()">Change style of the left border</button>

<script>
function myFunction() {
  document.getElementById("myDiv").style.borderLeftStyle = "dotted";
}
</script>

</body>
</html>



PreviousNext

Related