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

js关闭窗口的问题
一个页面上有个链接    点击它   会出现这种情况如图

这个图片中间的内容  其实也是一个页面!!
问:
这种效果用js怎么实现?  当点击confirm的时候  等待一段是时间后这个层就会消失!这个效果又怎么实现?
求各位大神帮帮忙!!!

------解决方案--------------------
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<div id='vv'>click</div>
<script>
function setStyle(elm,obj){
}
function close(){
var $e = document.getElementById('mask');
$e.style.display='none';
}
function display(){
var $e = document.getElementById('mask');
$e.style.display='block';
}
function createMask(){
var $dw =document.documentElement.clientWidth;
var $dh = document.documentElement.clientHeight;
var $m,$d,$close;

////mask
var $m = document.createElement('div');
//setStyle();
$m.id='mask';
$m.style.height = $dh + 'px';
$m.style.width = $dw + 'px';
$m.style.position = 'absolute';
$m.style.left = '0px';
$m.style.top ='0px';
$m.style.backgroundColor = '#ee9';
document.body.appendChild($m);

///dialog
var $d = document.createElement('div');
$d.id='dialog';
$d.style.height = '100px';
$d.style.width = '200px';
$d.style.position = 'absolute';
$d.style.left = ($dw/2-200/2)+'px';
$d.style.top =($dh/2-100/2)+'px';
$d.style.backgroundColor = '#e11';
$d.innerHTML = "<div id='close'>close</div>";
$m.appendChild($d);

//attach event
var $close = document.getElementById('close');
$close.addEventListener('click',close);
}
createMask();
document.getElementById('vv').onclick = display;


</script>
</body>
</html>

------解决方案--------------------
本帖最后由 showbo 于 2014-01-03 10:22:56 编辑
示例里面有使用说明啊

http://www.coding123.net/eg/tipsWindown/

7.弹出一个不能拖动,三秒钟自动关闭的层:

tipsWindown("提示","iframe:http://bbs.csdn.net/","500","350","false","3000","true","msg")