Javascript DOM Element Style Set

Description

Javascript DOM Element Style Set

View in separate window

<!DOCTYPE html>

<html lang="en">
<style>
#divAdvert {//  ww w.j  a v  a2  s.  c om
  font: 12pt arial;
}
</style>
</head>
<body>
  <div id="divAdvert">Here is an advertisement.</div>

  <script> 
        let divAdvert = document.getElementById("divAdvert"); 
        divAdvert.style.fontStyle = "italic"; 
        divAdvert.style.textDecoration = "underline"; 
    </script>

</body>
</html>



PreviousNext

Related