gpt4 book ai didi

javascript - 鼠标悬停 mouseout JavaScript 不工作

转载 作者:太空宇宙 更新时间:2023-11-03 23:16:11 25 4
gpt4 key购买 nike

我试图让一个元素在客户的鼠标悬停在它上面时出现,并在它离开对象时消失,但它不起作用。这是非常简单的代码,我不明白为什么它不起作用。这是代码:

var earlyBirds = document.getElementById("earlyBirds");
var block = document.getElementById("block");

var appearenceEB = function(){
block.style.visibility = visible;
}

var dissappearenceEB = function(){
block.style.visibility = hidden;
}

earlyBirds.addEventListener("mouseover", appearenceEB);
earlyBirds.addEventListener("mouseout", dissappearenceEB);

最佳答案

visiblehidden 应该用引号引起来。

var appearenceEB = function(){
block.style.visibility = "visible";
}

var dissappearenceEB = function(){
block.style.visibility = "hidden";
}

关于javascript - 鼠标悬停 mouseout JavaScript 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30464858/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com