generate a simple piece of code that displays a @ sign in a text box in the middle of…
- User
generate a simple piece of code that displays a @ sign in a text box in the middle of the screen that can be moved with the arrow keys.
Assistant
Here's a simple HTML/JavaScript code that creates a movable @ symbol in a text box:
<!DOCTYPE html> <html> <head> <style> #container { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); } #textbox { width: 30px; height: 30px; text-align: center; font-size: 20px; } </style> </head> <body> <div id="container"> <input type="text" id="textbox" value="@" readonly> </div> <script> const textbox = document.getElementById('textbox'); const container = document.getElementById('container'); let top = 50; let left = 50; const step = 10; document.addEventListener('keydown', (e) => { switch(e.key) { case 'ArrowUp': top -= step; break; case 'ArrowDown': top += step; break; case 'ArrowLeft': left -= step; break; case 'ArrowRight': left += step; break; } container.style.top = top + '%'; container.style.left = left + '%'; }); </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.