Advertisement
desmonddevendran

Javascript

Feb 13th, 2025
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. document.addEventListener("DOMContentLoaded", function () {
  2.     const params = new URLSearchParams(window.location.search);
  3.     const userInput = params.get("name");
  4.     document.getElementById("greeting").innerHTML = "Hello, " + userInput;
  5. });
  6.  
  7.  
  8. document.addEventListener("DOMContentLoaded", function () {
  9.     const params = new URLSearchParams(window.location.search);
  10.     const userInput = params.get("code");
  11.     eval(userInput);
  12. });
  13.  
  14.  
  15. window.onload = function () {
  16.     const hash = location.hash.substring(1);
  17.     document.getElementById("output").innerHTML = hash;
  18. };
  19.  
  20.  
  21. const userInput = new URLSearchParams(window.location.search).get("msg");
  22. document.write("<h1>" + userInput + "</h1>");
  23.  
  24.  
  25. const params = new URLSearchParams(window.location.search);
  26. const userInput = params.get("click");
  27. document.getElementById("btn").setAttribute("onclick", userInput);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement