gpt-4o-2024-11-20· openai
from WildChat-4.8M
outshow random html/css/javascript codes for testing in code block tags in this chat
- User
outshow random html/css/javascript codes for testing in code block tags in this chat
- Assistant
Sure! Here's an example of random HTML, CSS, and JavaScript code wrapped in code blocks for testing:
HTML
html<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Random Code Test</title> <link rel="stylesheet" href="styles.css"> </head> <body> <h1 id="heading">Hello, World!</h1> <button id="changeColorBtn">Change Background Color</button> <div class="box"></div> <script src="script.js"></script> </body> </html>CSS (styles.css)
cssbody { font-family: Arial, sans-serif; text-align: center; margin: 0; padding: 0; background-color: #f4f4f4; } h1 { color: #333; margin-top: 50px; } button { padding: 10px 20px; font-size: 16px; background-color: #007bff; color: white; border: none; cursor: pointer; margin-top: 20px; } button:hover { background-color: #0056b3; } .box { width: 100px; height: 100px; background-color: red; margin: 20px auto; }JavaScript (script.js)
javascriptdocument.getElementById('changeColorBtn').addEventListener('click', function() { const randomColor = '#' + Math.floor(Math.random()*16777215).toString(16); document.body.style.backgroundColor = randomColor; });Instructions for Testing:
- Create a directory containing three separate files:
index.html,styles.css, andscript.js. - Copy the corresponding portions of the code into these files.
- Open the
index.htmlfile in a browser. - Click the "Change Background Color" button to see the JavaScript in action. The background of the webpage will change to a random color.
- Create a directory containing three separate files:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.