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; width:300px; height:200px; display:none; border:solid 1px red; position:absolute;">
    
</div>

相关文章:

  • 2021-07-18
  • 2021-10-07
  • 2022-12-23
  • 2021-04-26
  • 2022-03-09
  • 2022-12-23
  • 2021-08-20
  • 2022-01-20
猜你喜欢
  • 2022-12-23
  • 2021-05-19
  • 2022-12-23
  • 2021-04-05
  • 2022-12-23
  • 2022-03-12
  • 2022-12-23
相关资源
相似解决方案