日期:2014-05-16  浏览次数:20480 次

用JQuery删除Div在IE没问题,在Firefox有奇怪问题(需要在页面任何一处单击左键DIV才消失),请高手分析下原因,并给出解决方案,谢谢!
Div样式:
#dimmer 
{
display: none;
position: absolute;
top: 0;
left: 0;
background: #000000;
filter:alpha(opacity=50); /* Internet Explorer */
-moz-opacity:0.5; /* Mozilla 1.6 and below */
opacity: 0.5; /* newer Mozilla and CSS-3 */
}
#sessionNoticeBox
{
border: 2px #aaaaaa solid;
position: absolute;
top: 50%;
left: 50%;
padding: 20px;
margin: auto;
width: 300px;
padding-top: 40px;
height: 90px;
text-align: center;
margin-left: -200px;
margin-top: -100px;
background-color: #ffffff;
filter:alpha(opacity=100); /* Internet Explorer */
-moz-opacity:1.0; /* Mozilla 1.6 and below */
opacity: 1.0; /* newer Mozilla and CSS-3 */
}
  以下是删除Div的代码
if ($('#dimmer').length > 0) {
  $('#dimmer').remove();
  $('#sessionNoticeBox').remove();  
  }

------解决方案--------------------
JScript code

    <script type="text/javascript">
        $(document).ready(function () {
            if ($('#dimmer').length > 0) {
                $('#dimmer').remove();
                $('#sessionNoticeBox').remove();
            }
        });
    </script>