我正在尝试在图像悬停时显示一个按钮我现在拥有的是该按钮被禁用,并且在图像悬停时该按钮被启用。理想情况下,我希望按钮被隐藏,并且应该在图像悬停时“神奇地”出现。我已经在 C# 中做到了这一点。可以用 HTML、CSS 和 JS 来完成吗???Jquery 是我最后的选择......这是我的小提琴:http: //jsfiddle.net/RzZcZ/
HTML
<div>
<img width=100px; height=100px; src="https://www.nhs.uk/InformationServiceForParents/assets/images/home-baby.jpg" onMouseover="showButton()"></img>
<input type=button id="imgbutton" value="Open in new window" disabled="true">
</div>
JS
showButton = function () {
document.getElementById("imgbutton").disabled = false;
}