Why does it no work?


#1
<div id="dropdown-content">
						<a href="#" id="sign_in">Login</a>
						<a href="#" id="sign_up">Sign Up</a>

function F(){
var input = document.getElementById("sign_in");
var log_window = document.getElementById("login");
input.addEventListener("hover", Func());
function Func(){
if(log_window.style.display != "block"){
log_window.style.display = "block";
}else{
log_window.style.display = "none";
}
}
}


#2

var log_window = document.getElementById("login");

login is not an id name.

and here

input.addEventListener("hover", Func());

you don't need to call the function here.just write the name of the function.

input.addEventListener("hover", Func);

also you have to call the function named F to make it any use.


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.