write me a webpage containing a button centered on the page, that when click moves to a…
- User
write me a webpage containing a button centered on the page, that when click moves to a random location on the screen.
Assistant
Here is HTML and JavaScript code for a webpage with a centered button that moves to a random location when clicked:
html<!DOCTYPE html> <html> <head> <style> button { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); } </style> </head> <body> <button id="button">Click Me</button> <script> const button = document.getElementById("button"); button.addEventListener("click", () => { let x = Math.floor(Math.random() * window.innerWidth); let y = Math.floor(Math.random() * window.innerHeight); button.style.left = x + "px"; button.style.top = y + "px"; }); </script> </body> </html>
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.