Code
function show2(){
document.getElementById("overflow").style.display="block";
document.body.setAttribute("scroll","no");
setInnerDiv();
}
window.onresize=function setInnerDiv(){
var div=document.getElementById("div1");
var divwidth=div.style.width.substring(0,div.style.height.lastIndexOf("px"));
var left=document.body.clientWidth/2-parseInt(divwidth)/2;
div.style.left=left;
div.style.top=100;
div.style.zIndex=10000;
div.style.display="block";
}
</script>
<input type="button" value="click me" onclick="show()" />
<input type="button" value="click me2" onclick="show2()" />
<div id="overflow" style="display:none; z-index:9999; FILTER: alpha(opacity=80);LEFT: 0px;
WIDTH: 100%;
POSITION: absolute;
TOP: 0px;
HEIGHT: 100%;
BACKGROUND-COLOR: #000;
moz-opacity: 0.8;
opacity: .80"></div>
<div id="div1" style="background-color:Yellow; 300px; height:200px; display:none; border:solid 1px red; position:absolute;">
</div>
function show2(){
document.getElementById("overflow").style.display="block";
document.body.setAttribute("scroll","no");
setInnerDiv();
}
window.onresize=function setInnerDiv(){
var div=document.getElementById("div1");
var divwidth=div.style.width.substring(0,div.style.height.lastIndexOf("px"));
var left=document.body.clientWidth/2-parseInt(divwidth)/2;
div.style.left=left;
div.style.top=100;
div.style.zIndex=10000;
div.style.display="block";
}
</script>
<input type="button" value="click me" onclick="show()" />
<input type="button" value="click me2" onclick="show2()" />
<div id="overflow" style="display:none; z-index:9999; FILTER: alpha(opacity=80);LEFT: 0px;
WIDTH: 100%;
POSITION: absolute;
TOP: 0px;
HEIGHT: 100%;
BACKGROUND-COLOR: #000;
moz-opacity: 0.8;
opacity: .80"></div>
<div id="div1" style="background-color:Yellow; 300px; height:200px; display:none; border:solid 1px red; position:absolute;">
</div>