Set style by property name : setProperty « Style « JavaScript Tutorial






<html>
<head>
<title>Style Example</title>
</head>
<body>
<div id="div1"
     style="background-color: red; height: 50px; width: 50px"
     onmouseover="this.style.setProperty('background-color', 'blue', '')"
     onmouseout="this.style.setProperty('background-color', 'red', '')"></div>
</body>
</html>








22.13.setProperty
22.13.1.Set style by property name