When the button is pressed, the script is loaded(basic code)

<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>page</title> </head> <body> <p id="result"></p> <button type="button" id="externalJS">Call JS</button> <script> var getJS = document.getElementById("externalJS"); getJS.onclick = function () { var scriptCreate = document.createElement("script"); scriptCreate.type = "text/javascript"; document.body.appendChild(scriptCreate); } </script> </body> </html> BEFORE AFTER

JavaScript Calculator(radio button)

HTML CODE <div class="box"> <h2>calculator</h2> <input type="text" id="number1" placeholder="number1"/><br> <input type="text" id="number2" placeholder="number2"/><br> <label><input type="radio" id="rad1" name="same" />Collection<br></label> <label><input type="radio" id="rad2" name="same" />Extraction<br></label> <label><input type="radio" id="rad3" name="same" />Multiplication<br></label> <label><input type="radio" id="rad4" name="same" />Division<br></label> <input type="button" id="but" value="calculate" /> <div id="res"></div> </div> CSS CODE: body{ margin:0; padding:0; background:#262626; text-transform:uppercase; font-family:'AR JULIAN'; font-size:14px; } h2{ font-size:28px; padding:0;... Continue Reading →

Arrow Functions (JavaScript)

With this method, we can define anonymous function expressions in a short way. Example: var collection = (x, y) => x + y; document.write(collection(3,7)) Output:  10 Same as above example: var collection = function (x, y) { return x + y; }; document.write(collection(3,7)) As seen, the function expression is defined with a shorter method. The... Continue Reading →

Create a website or blog at WordPress.com

Up ↑

Design a site like this with WordPress.com
Get started