Author name: SAMEER SHAIK

JavaScript DOM Change Position of an Element

document object model it is interface for web documents <div id=”box” style=”width: 50px; height: 50px; background: green; position: absolute; top: 50px; left: 50px;”></div> <button onclick=”moveRight()”>Move Right</button> <script> function moveRight() { let box = document.getElementById(“box”); let left = parseInt(box.style.left) || 0; box.style.left = (left + 50) + “px”; } </script>    

File Uploading in Node.js

install multer npm install multer express create a file upload.js const express = require(“express”); const multer = require(“multer”); const app = express(); const port = 3000; // Configure multer for file uploads const storage = multer.diskStorage({ destination: (req, file, cb) => { cb(null, “uploads/”); }, filename: (req, file, cb) => { cb(null, Date.now() + “-” …

File Uploading in Node.js Read More »

CSS Code to Rotate an Element

it is an css code where an element can be rotated to rotate an element it is a basic rotation of 45degrees   .rotate { width: 100px; height: 100px; background-color: blue; transform: rotate(45deg); } usage in html in division tag   <div class=”rotate”></div>      

Submit a form in post method in Node.js

install express and body-parser sh npm install express body-parser multer server.js const express = require(“express”); const bodyParser = require(“body-parser”); const app = express(); const port = 3000; app.use(bodyParser.urlencoded({ extended: true })); // Serve HTML form app.get(“/”, (req, res) => { res.send(` <form action=”/submit” method=”POST”> <input type=”text” name=”name” placeholder=”Enter your name” required /> <button type=”submit”>Submit</button> </form> …

Submit a form in post method in Node.js Read More »

Submit a form in post method in Node.js

<!DOCTYPE html> <html lang=”en”> <head>   <meta charset=”UTF-8″>   <meta name=”viewport” content=”width=device-width, initial-scale=1.0″>   <title>Form Submission</title> </head> <body>   <h1>Submit Form</h1>   <form action=”/submit” method=”POST”>     <label for=”name”>Name:</label>     <input type=”text” id=”name” name=”name” required><br><br>     <label for=”email”>Email:</label>     <input type=”email” id=”email” name=”email” required><br><br>     <button type=”submit”>Submit</button>   </form> </body> </html> …

Submit a form in post method in Node.js Read More »

Scroll to Top