Jump to content

Masuen

Members
  • Posts

    1
  • Joined

  • Last visited

Everything posted by Masuen

  1. Hi! Im trying to add a function that gives the text in my code a random background color (either yellow, red or green). I want this random color change to happen when I press the button. Can anyone help me with this? my code sofar is: <!DOCTYPE html> <html> <body> <p id="output_paragraph">Click the button to change the text in this paragraph.</p> <button onclick="myFunction()">Try it</button> <script> function myFunction() { document.getElementById("output_paragraph").innerHTML = "Hello World"; } </script> </body> </html>
×
×
  • Create New...