140,511 views
18 votes
18 votes
Whats wrong with my code for .addEventListener

Html code:






Don't Give Up











Home
TAKE ACTION

Fighters



a:link {
color: Blue;
background-color: transparent;
text-decoration: none;
}

a:visited {
color: Purple;
background-color: transparent;
text-decoration: border;
}

a:hover {
color: black;
background-color: transparent;
text-decoration: underline;
}

a:active {
color: Blue;
background-color: transparent;
text-decoration: underline;
}




Extra Facts
Click Me


Java code:
var factList = [
"Mo", /*0*/
"ok", /*1*/
"oh", /*2*/
"shh"]; /*3*/

var fact = document.getElementById("fact");
var wind = document.getElementById('wind');

var count = 0;

wind.addEventListener('click', displayfact());

function displayfact(){
fact.innerHTML = factList[count];
count++;
if (count == factList.length){
count = 0;
}
}

User Ishihara
by
2.9k points

1 Answer

18 votes
18 votes

Answer:

Java code that is what I think

User Demula
by
2.7k points