Get the value of a <p> element's top-border:
var x = document.getElementById("myP").style.borderTop;
<!DOCTYPE html> <html> <body> <p id="myP" style="border-top: 5px solid red;">Click the button to get the value of my top border.</p> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {//from www . j a v a2 s .co m var x = document.getElementById("myP").style.borderTop; document.getElementById("demo").innerHTML = x; } </script> </body> </html>