Return the width of the border of a <div> element:
alert(document.getElementById("myDiv").style.borderWidth);
<!DOCTYPE html> <html> <body> <div id="myDiv" style="border:1px solid black">This is a div element.</div> <br> <button type="button" onclick="myFunction()">Return the width of the border</button> <p id="demo"></p> <script> function myFunction() {/* w w w. ja v a 2 s . c o m*/ document.getElementById("demo").innerHTML = document.getElementById("myDiv").style.borderWidth; } </script> </body> </html>