这是我的代码,用于在我将鼠标悬停在图像上时显示警报;
var special_offers = document.getElementsByClassName("special_offer");
//for each special offer
for(i=0;i<special_offers.length;i++){
var special_offer = special_offers[i];
special_offer.setAttribute("offer_shown", "0");
special_offer.onmouseover = function(){
if( this.getAttribute("offer_shown") == "0" ){
this.setAttribute("offer_shown", "1");
alert('This room has the special offer attached to it, please book soon before you miss out!');
}
}
我想了解如何将其从沼泽标准 JS 警报更改为我可以设置样式的框,我想我会使用某种 div。
非常感谢任何帮助。
最佳答案
http://www.webdesignerdepot.com/2012/10/creating-a-modal-window-with-html5-and-css3/
这是创建您自己的模态窗口的好资源。您可以使用您的函数来触发您创建的模态窗口,而不是仅仅使用 alert() 来触发标准警报。
关于javascript - 样式化 JavaScript onmouseover 警报,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16137804/