The most viewed posts

Registry Reviver

How to clean up Windows Computer

About Desktop Icons in Windows Computer

Driver Booster

CCleaner

Myanmar font and keyboard for Windows

Advanced System Care

some (JavaScript Array Method)

Web Development Services

How to make a computer secure and run faster

The most viewed items

Desktop Hard Disk

Dell Inspiron 5559

HP ProBook 430

SONY Playstation Portable

Laptop RAM

External Hard Disk

Laptop

ZilaStar ICT Jan 13 2022, 19:54:27
Category : JavaScript Tutorials

Array Function

<!DOCTYPE html>
<html>
<head>
<title>JavaScript Code Testing</title>
</head>
<body>
<button id = "btn1">Try Now</button>
<p id = "demo1"></p>

<button id = "btn2">Try Now</button>
<p id = "demo2"></p>

<script>
var test1 = function(){
document.getElementById("demo1").innerHTML += this;
}

//window object calls the function
window.addEventListener("load", test1);

//button object calls the function
document.getElementById("btn1").addEventListener("click", test1);

var test2 = () =>{
document.getElementById("demo2").innerHTML += this;
}

//window object calls the function
window.addEventListener("load", test2);

//button object calls the function
document.getElementById("btn2").addEventListener("click", test2);

</script>
</body>
</html>

  • Comments:

    No comment to show.

    To Contact
    Available Services
    Terms and Conditions