点击按钮弹出 蒙板 操作页面

来源:互联网 发布:淘宝怎么撤回退款申请 编辑:程序博客网 时间:2024/06/06 01:29

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <style type="text/css">
        #divMenBan
        {
            display: none;
            position: absolute;
            z-index: 1000;
            height: 100%;
            width: 100%;
            left: 0px;
            top: 0px;
            background: #000000;
            filter: Alpha(opacity=30);
        }
        #divDisplay
        {
            display: none;
            position: absolute;
            height: 100%;
            width: 100%;
            padding-top: 10%;
            z-index: 1001;
            left: 0px;
            top: 0px;
        }
    </style>
    <script type="text/javascript">
        function ShowDisplay() {

            var winWH = getPageSize();
            //alert(winWH[0] + "  " + winWH[1] + "  " + winWH[2] + "  " + winWH[3] + "  ");
            document.getElementById('divMenBan').style.width = winWH.x.toString() + "px";
            document.getElementById('divMenBan').style.height = winWH.y.toString() + "px";
            document.getElementById('divDisplay').style.width = winWH.x.toString() + "px";
            document.getElementById('divDisplay').style.height = winWH.y.toString() + "px";
            if (document.getElementById('divDisplay').style.display == 'none' || document.getElementById('divDisplay').style.display == '') {
                document.getElementById('divMenBan').style.display = 'block';
                document.getElementById('divDisplay').style.display = 'block';
            }


        }
        function getPageSize() {

            var xScroll, yScroll;

            if (window.innerHeight && window.scrollMaxY) {
                xScroll = document.body.scrollWidth;
                yScroll = window.innerHeight + window.scrollMaxY;
            } else if (document.body.scrollHeight > document.body.offsetHeight) { // all but Explorer Mac
                xScroll = document.body.scrollWidth;
                yScroll = document.body.scrollHeight;
            } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
                xScroll = document.body.offsetWidth;
                yScroll = document.body.offsetHeight;
            }

            var windowWidth, windowHeight;
            if (self.innerHeight) { // all except Explorer
                windowWidth = self.innerWidth;
                windowHeight = self.innerHeight;
            } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
                windowWidth = document.documentElement.clientWidth;
                windowHeight = document.documentElement.clientHeight;
            } else if (document.body) { // other Explorers
                windowWidth = document.body.clientWidth;
                windowHeight = document.body.clientHeight;
            }

            // for small pages with total height less then height of the viewport
            if (yScroll < windowHeight) {
                pageHeight = windowHeight;
            } else {
                pageHeight = yScroll;
            }

            // for small pages with total width less then width of the viewport
            if (xScroll < windowWidth) {
                pageWidth = windowWidth;
            } else {
                pageWidth = xScroll;
            }


            //arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
            return { x: pageWidth, y: pageHeight };
        }
        var resizeTime = null;
        window.onresize = function () {
            if (resizeTime == null) {
                resizeTime=setTimeout(doResize, 100);
            }
        }
        function doResize() {
            var winWH = getPageSize();
            document.getElementById('divMenBan').style.width = winWH.x.toString() + "px";
            document.getElementById('divMenBan').style.height = winWH.y.toString() + "px";
            document.getElementById('divDisplay').style.width = winWH.x.toString() + "px";
            document.getElementById('divDisplay').style.height = winWH.y.toString() + "px";
        }
    </script>
</head>
<body>
    <div>
        <input type="button" value="弹出" onclick='ShowDisplay();' />
    </div>
    <div id='divMenBan'>
    </div>
    <div id='divDisplay'>
        ksksjksjfksdjfdkasfjasdkfasd
        <br />
        dsafadskfjsalkfj
        <br />
        dsafadskfjsalkfj
        <br />
        dsafadskfjsalkfj
        <br />
        dsafadskfjsalkfj
        <br />
        dsafadskfjsalkfj
        <br />
        dsafadskfjsalkfj
    </div>
</body>
</html>

原创粉丝点击