Please look at the string of practice code below, Why will the multiple events I have here using addEventListener() fail to proceed to operate? I am using IE11.
Here is the exact HTML file :
<!DOCTYPE html>
<html>
<body>
<p>This example uses the addEventListener() method to add many events on the same button.</p>
<button id="myBtn">Try it</button>
<p id="demo4"></p>
<script>
var x = document.getElementById("myBtn");
x.addEventListener("(x)", myFunction);
x.addEventListener("setMaximum", mySecondFunction);
x.addEventListener("popup", myThirdFunction);
</script>
var x = document.getElementById("myBtn");
x.addEventListener("(x)", myFunction);
x.addEventListener("setMaximum", mySecondFunction);
x.addEventListener("popup", myThirdFunction);
</script>
<head>
<script src="html and .js practice"> </script> </head>
</body>
</html>
Here is the exact JavaScript from an external file:
function myFunction(x) {
x.style.background = "yellow";
}
function setMaximum() {
var myNumber = 2;
var txt = "";
while (myNumber != Infinity) {
myNumber = myNumber * myNumber;
txt = txt + myNumber + "<br>";
} document.getElementById("demo").innerHTML = txt;
}
function myFunction() {
document.getElementById("demo4").innerHTML =
Math.min(0, 150, 30, 20, -8, -200);
}
function popup() {
alert("Hello World")
}