Javascript DOM CSS Style outlineStyle Property get

Introduction

Return the outline style of a <div> element:

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

View in separate window

<!DOCTYPE html>
<html>
<head>
<style>
#myDiv {/*  w w  w  .  j  a va2 s .c  o  m*/
  border: 1px solid red;
}
</style>
</head>
<body>

<div id="myDiv" style="outline-style:dotted;">This is a div element.</div>
<br>
<button type="button" onclick="myFunction()">Return outline style</button>

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

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

</body>
</html>



PreviousNext

Related