Javascript examples for DOM HTML Element:Style
Set the style properties of an existing element:
<!DOCTYPE html> <html> <body> <h1 id="myH1">a header</h1> <button onclick="myFunction()">change the style of the H1 element</button> <script> function myFunction() {//from ww w . j a v a 2 s .co m document.getElementById("myH1").style.color = "red"; } </script> </body> </html>