<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script src="http://www.pc120xz.cn/root/scripts/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
</head>
<body>
<div id="top" style="height:99px; border:1px solid #933; background-color:#999999;">
</div>
<div id="divmain">
<iframe name="contentFrame" id="contentFrame" width="100%" height="500" allowtransparency="true" scrolling="no" border="0" frameborder="0" src="http://www.baidu.com/" ></iframe>
</div>
<div id="bottom" style="height:99px; border:#06F solid 1px; background-color:#999999;">此处显示 id "bottom" 的内容</div>
<script type="text/javascript">
$(document).ready(function(){
$("#ListShow").bind("click",function(){
$('#Main_pl1').animate({height:'show', opacity: 'show'}, 'normal',function(){
$('#Main_pl1').show();
});
$('#ListShow').attr('style','display:none');
$('#ListHide').attr('style','display:block');
return false;
});
$("#ListHide").bind("click",function(){
$('#Main_pl1').animate({height:'hide', opacity: 'hide'}, 'normal',function(){
$('#Main_pl1').hide();
});
$('#ListShow').attr('style','display:block');
$('#ListHide').attr('style','display:none');
});
$(document).bind("click",function(event){
if($(event.target).isChildOf("#Main_pl1") == false){
$('#Main_pl1').animate({height:'hide', opacity: 'hide'}, 'normal',function(){
$('#Main_pl1').hide();
});
$('#ListShow').attr('style','display:block');
$('#ListHide').attr('style','display:none');
}
});
$.fn.isChildAndSelfOf = function(b){
return (this.closest(b).length > 0);
};
$.fn.isChildOf = function(b){
return (this.parents(b).length > 0);
};
});
</script>
<div id="MainA1" style="position:fixed;left:0px;bottom:2px;_position:absolute;">
<div id="Main_pl1" style="display:none;">
<div class="Main_pl1m" style="width:400px; height:200px; background:#666666;">点击此DIV外任意地方隐藏此DIV</div>
</div>
<div id="Main_pm1" style="width:400px; height:120px;">
<div class="Main_pm1m overz" style="border:#9CC solid 1px;">
<span title="打开列表" id="ListShow" style="display:block;">测试这个</span>
<span title="关闭列表" id="ListHide" style="display:none;">测试这个</span>
</div>
</div>
</div>在同一页面可以 但DIV浮动到iframe上时 失效
</body>
</html>