Return the right border color of a <div> element:
alert(document.getElementById("myDiv").style.borderRightColor);
<!DOCTYPE html> <html> <body> <div id="myDiv" style="border-right:thick solid green">This is a div.</div> <br> <button type="button" onclick="myFunction()">Return right border color</button> <p id="demo"></p> <script> function myFunction() {// w ww . j ava 2s. c o m document.getElementById("demo").innerHTML = document.getElementById("myDiv").style.borderRightColor; } </script> </body> </html>