Change the style of the four borders of a <div> element: - Javascript CSS Style Property

Javascript examples for CSS Style Property:borderStyle

Description

Change the style of the four borders of a <div> element:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<head>
<style>
#myDiv {//from  ww w.ja  va  2 s. co  m
    border: thick solid #FF0000;
}
</style>
</head>
<body>

<div id="myDiv">This is a div.</div>
<br>
<button type="button" onclick="myFunction()">Change style of the four borders</button>

<script>
function myFunction() {
    document.getElementById("myDiv").style.borderStyle = "dotted solid double dashed";
}
</script>

</body>
</html>

Related Tutorials