I can't change permanently the background color of a simple html page using javascript

when I click in the button the backgrounf color of the change but after one seconde it disappear

this is the code

<!DOCTYPE html>
<html>
    <head>
        <title>ex7</title>
        <meta charset="utf-8"> 
        <script>
            function changerCouleur() {
                document.bgColor= "#FFFggF";
            }
        </script>
    </head>
    <body>
      <form>
          couleur  <input type="text" > <br>
          <button onclick="changerCouleur()">changer couleur </button>
      </form>
    </body>
</html>

8 thoughts on “I can't change permanently the background color of a simple html page using javascript”

Leave a Comment