2014-12-04 79 views
0

这个脚本在IE浏览器中失败,弹出窗口,但关闭按钮不工作,它在firfox和谷歌浏览器中工作正常。弹出式关闭按钮在Internet Explorer中不起作用?

#note { 
    position: relative; 
    z-index: 101; 
    top: 0; 
    left: 0; 
    right: 0; 
    background: #fde073; 
    text-align: center; 
    line-height: 2.5; 
    overflow: hidden; 
    -webkit-box-shadow: 0 0 5px black; 
    -moz-box-shadow: 0 0 5px black; 
    box-shadow:   0 0 5px black; 
} 


<div id="note"> 
    You smell good. <a id="close">[close]</a> 
<script> 
close = document.getElementById("close"); 
close.addEventListener('click', function() { 
    note = document.getElementById("note"); 
    note.style.display = 'none'; 
}, false); 
</script></div> 
+0

这是可以在其他浏览器中使用吗? – 2014-12-04 05:17:45

+0

根据用户在Firefox和Chrome中工作。 – AaronS 2014-12-04 05:18:32

+0

您正在测试什么版本的Internet Explorer? – AaronS 2014-12-04 05:26:36

回答

1

JavaScript并不是跨浏览器的支持,使用jQuery代替

$("#close").on('click', function() { 
    $("#note").hide(); 
}); 
2

变化密切变量,接近是一个事件不变量。

<script> 
divclose = document.getElementById("close"); 
divclose.addEventListener('click', function() { 
    note = document.getElementById("note"); 
    note.style.display = 'none'; 
}, false); 
</script> 
+0

现在弹出窗口关闭罚款。 – 2014-12-05 02:14:38

+0

我为我的部门创建了一个主页,该页面脚本访问正常的办公室服务器,但从服务器访问网页时出现问题,但从我的电脑打开时工作正常。它需要任何特殊服务器? – 2014-12-07 02:15:59

+0

检查apache服务器版本或PHP版本。你有没有使用任何PHP代码? – Muthukumar 2014-12-08 06:18:32