अवलोकन
1 से 200 के बीच रैंडम पूर्णांक प्राप्त करने के लिए Math.random() और Math.floor() का उपयोग करें और 1 जोड़ें।
उदाहरण
<!DOCTYPE html> <html> <body> <script> document.write(Math.floor(Math.random() * 200) + 1); </script> </body> </html>
1 से 200 के बीच रैंडम पूर्णांक प्राप्त करने के लिए Math.random() और Math.floor() का उपयोग करें और 1 जोड़ें।
<!DOCTYPE html> <html> <body> <script> document.write(Math.floor(Math.random() * 200) + 1); </script> </body> </html>
JavaScript से पासवर्ड विजिबिलिटी टॉगल कैसे करें?
JavaScript का उपयोग करके पासवर्ड विजिबिलिटी (दिखाना/छुपाना) टॉगल करने का कोड नीचे दिया गया है। उदाहरण <!DOCTYPE html> <html> <head> <h1>पासवर्ड विजिबिलिटी उदाहरण</h1> पासवर्ड: <input type=password value=abcd@1234 id=inputPass /><br /><br />
JavaScript से एलिमेंट छुपाएं/दिखाएं टॉगल करें
किसी एलिमेंट की विजिबिलिटी को टॉगल करना (दिखाना/छुपाना) JavaScript के सबसे आम कार्यों में से एक है। इसे style.display, style.visibility, या hidden एट्रिब्यूट के साथ किया जा सकता है। उदाहरण (display टॉगल) <!DOCTYPE html> <html> <head> <meta name=viewport content=width=device-wid
CSS और JavaScript से लाइक/डिस्लाइक बटन टॉगल बनाएं
Font Awesome आइकॉन्स और JavaScript का उपयोग करके एक इंटरैक्टिव लाइक/डिस्लाइक बटन बनाना जिसमें क्लिक पर एनिमेशन और स्टेट टॉगल शामिल हो। उदाहरण <!DOCTYPE html> <html> <head> <link rel=stylesheet href=https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css />