Jump to content

JinRipa

Members
  • Posts

    1
  • Joined

  • Last visited

Posts posted by JinRipa

  1. Hi

    Can I use a function like this to change the background of a body tag that has a class instead of an ID?

    <body id="cbg">

    <button onclick="changeBG()">Change Background</button>
    <script>
    function changeBG(){document.getElementById('cbg').style.background = "repeating-radial-gradient(#444 0%,#222 10%,#444 40%) 0 / 12px 12px"}
    </script>

    -----------------------------------------------------

    <body class="cbg">

    <button onclick="changeBG()">Change Background</button>
    <script>
    function changeBG(){document.getElementByClassName('cbg').style.background = "repeating-radial-gradient(#444 0%,#222 10%,#444 40%) 0 / 12px 12px"}
    </script>

×
×
  • Create New...