Generation

generate functionWed, 07 Jun 2023

code of a calculator with html

var http = require('http'); http.createServer(function (req, res) { // GET 요청이 왔을 때 if(req.method === 'GET') { html = ` <html> <head><meta charset=utf-8></head> <body> <form action="/" method="post"> <input type="text" name="a"> + <input type="text" name="b"> <button type="submit">=</button> </form> </body> </html> `; res.writeHead(200); res.end(html); } // POST 요청이 왔을 때 else if(req.method === 'POST') { req.on('data', function(data) { var post = qs.parse(data.toString()); var a = parseInt(post.a); var b = parseInt(post

Javascript
Generate More

Questions about programming?Chat with your personal AI assistant