Change the color of the top and bottom border to green, and left and right border to purple, of a <div> element:
document.getElementById("myDiv").style.borderColor = "green purple";
<!DOCTYPE html> <html> <head> <style> #myDiv {/*from w ww . j a v a2 s . co m*/ border: thick solid blue; } </style> </head> <body> <div id="myDiv">This is a div.</div> <br> <button type="button" onclick="myFunction()">Change color of the four borders</button> <script> function myFunction() { document.getElementById("myDiv").style.borderColor = "green purple"; } </script> </body> </html>