Click on any text, see what happens.
This uses an inline script to do the work (no separate .js file).



The body code used is:

<body> <div onclick="randomBGColor()"> <p> Click on any text, see what happens.<br /> This uses an <em>inline</em> script to do the work (no separate .js file). </p> </div> <script> function randomBGColor() { let r, g, b; r = Math.floor(Math.random() * 256); g = Math.floor(Math.random() * 256); b = Math.floor(Math.random() * 256); document.body.style.backgroundColor = `rgb(${r}, ${g}, ${b})`; } </script> </body>