o3-mini· OpenAI
LMArena Human Preference 140K
make a form that multiplies two numbers together and provides an output. make form pretty
- User
make a form that multiplies two numbers together and provides an output. make form pretty
- Assistant
Below is an example of a simple and attractive HTML form that lets you multiply two numbers and displays the result. This example uses Bootstrap for styling along with some custom CSS:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Multiply Two Numbers</title> <!-- Bootstrap CSS --> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" > <style> body { background: linear-gradient(45deg, #6a11cb, #2575fc); min-height: 100vh; display: flex; align-items: center; justify-content: center; } .card { padding: 30px; border: none; border-radius: 8px; box-shadow: 0 4px 8px rgba(0,0,0,0.2); } .result { margin-top: 20px; } </style> </head> <body> <div class="card"> <h3 class="card-title text-center mb-3">Multiply Two Numbers</h3> <form id="multiplyForm"> <div class="form-group"> <label for="num1">First Number</label> <input type="number" step="any" class="form-control" id="num1" placeholder="Enter first number" required> </div> <div class="form-group"> <label for="num2">Second Number</label> <input type="number" step="any" class="form-control" id="num2" placeholder="Enter second number" required> </div> <button type="submit" class="btn btn-primary btn-block">Multiply</button> </form> <div class="result text-center"> <h4>Result: <span id="output">0</span></h4> </div> </div> <script> document.getElementById("multiplyForm").addEventListener("submit", function(e) { e.preventDefault(); // Prevent the default form submission // Parse the input values let num1 = parseFloat(document.getElementById("num1").value) || 0; let num2 = parseFloat(document.getElementById("num2").value) || 0; // Multiply the numbers let result = num1 * num2; // Display the result document.getElementById("output").textContent = result; }); </script> <!-- Optional: Bootstrap JS and dependencies --> <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script> </body> </html>How It Works
- HTML Form: Two
<input>fields take numerical input for the numbers you want to multiply. - Bootstrap & Custom CSS: These style the layout to be centered with a gradient background and a neat card.
- JavaScript: An event listener on the form captures the submission, prevents the default form behavior, calculates the product of the two numbers, and updates the displayed result.
You can save this code as an HTML file and open it in your browser to see it in action. Enjoy!
- HTML Form: Two
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.