Javascript DOM Element Style Set Background Color

Description

Javascript DOM Element Style Set Background Color

View in separate window

<html>
   <head>
      <script type = "text/javascript">
         function start()//from  w  ww  .  j a v a 2 s.  c om
         {
            let inputColor = "red";                   
            document.body.style.backgroundColor = inputColor;     
         }
      </script>
   </head>
   <body onload = "start()">
      <p>Welcome to our website!</p>
   </body>
</html>



PreviousNext

Related