[Javascript] someJavascript (DOM)

  1. Include Scripts
  2. #script src="myscript.js"##/script# --- Before closing body tag

  3. createElement(), appendChild(), setAttribute
  4.             const itemA = document.createElement("b")
                itemA.innerText = "Have a great day"
                document.getElementById("halo").appendChild(itemA)
                itemA.setAttribute("style","color:Red")
                
  5. Dialog Box

  6.               a = window.alert("Have a good time");
    
                  b = window.confirm("Yes or No");
                  window.alert(b); 
    
                  c = window.prompt("How are you today?");
                  window.alert(c);
                
  7. Pop-up Windows
  8. Google yourself. hehe

  9. setTimeOut

  10.             const count = (function () {
                  let num = 10;
                  return function () {
                    return num--;
                  };
                })();
          
                function countDown() {
                  const info = document.getElementById("info");
                  let timerId = null;
                  let num = count();
          
                  if (num > 0) {
                    info.innerHTML += "" + num + "/";
                    timerId = window.setTimeout(countDown, 1000);
                  } else {
                    info.innerHTML += "Time's up";
                    window.clearTimeout(timerId);
                  }
                }
          
                countDown();
              
              
  11. Control Location
    • location.href ---
    • location.protocol ---
    • location.host ---
    • location.pathname ---
    • location.hash ---
  12. document.lastModified
  13. document.referrer
  14. *Only applies to web server nia. This is good

  15. Manage Coolies
  16. Google yourself. hehe

Source: ---


Disclaimer: The information in this webpage is shared by anonymous users from external online sources. We cannot guarantee its accuracy or truthfulness. Users should exercise caution and verify information independently.


© 2023 sunnypeaceisland.com