惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

A
About on SuperTechFans
小众软件
小众软件
WordPress大学
WordPress大学
Microsoft Azure Blog
Microsoft Azure Blog
Recent Announcements
Recent Announcements
博客园 - 三生石上(FineUI控件)
博客园_首页
N
Netflix TechBlog - Medium
IT之家
IT之家
H
Help Net Security
博客园 - 聂微东
Google DeepMind News
Google DeepMind News
罗磊的独立博客
T
Tailwind CSS Blog
F
Fortinet All Blogs
Hugging Face - Blog
Hugging Face - Blog
MongoDB | Blog
MongoDB | Blog
V
V2EX
量子位
云风的 BLOG
云风的 BLOG
爱范儿
爱范儿
博客园 - 司徒正美
The Cloudflare Blog
Engineering at Meta
Engineering at Meta

博客园 - shcity

Troubleshooting on TransactionScope Parse string to JSON object Parse date in js blockUI doesn't close when download file in asp.net define namespace in JS Dense_Rank(), Row_Number(), Rank() in sql server reading and writing variable through lock in SSIS script task Fix the issue that cannot open SSIS in BIDS three ways creating custom helpers to show RadioButtonList in MVC using JavaScriptSerializer to serialize object to json using ISerializable to control serialization and deserialization ViewStateAutoManager ReportingService formatting Build my own DataTable split a string into an array through comma 正则表达式替换日期 半透明的div对话框 foreach 的自动转化类型 在Ajax1.0中调用页面CS文件中的方法
div with separated html template - shcity
shcity · 2011-01-24 · via 博客园 - shcity

代码

<!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>
    
<script>
        
function setSize(div, innerDiv) {
            
var doc = document.documentElement;
            
var sw = parseFloat(doc.scrollWidth);
            
var cw = parseFloat(doc.clientWidth);
            
var sh = parseFloat(doc.scrollHeight);
            
var ch = parseFloat(doc.clientHeight);

            div.style.width 

= sw >= cw ? sw : cw;
            div.style.height 
= sh >= ch ? sh : ch;

            innerDiv.style.display 

= '';
            innerDiv.style.left 
= parseFloat(doc.scrollLeft) + cw / 2 - parseFloat(innerDiv.clientWidth) / 2;
            innerDiv.style.top 
= parseFloat(doc.scrollTop) + ch / 2 - parseFloat(innerDiv.clientHeight) / 2;

        }

function openNewWindow() {
            
var div = document.getElementById("container");
            
var innerDiv = document.getElementById("content");
            setSize(div, innerDiv);

            window.attachEvent(

"onresize"function() { setSize(div, innerDiv) });
            window.attachEvent(
"onscroll"function() { setSize(div, innerDiv) }); 

        }

function closeWindow() {
            
var div = document.getElementById("container");
            
var innerDiv = document.getElementById("content");
            div.style.width 
= 0;
            div.style.height 
= 0;
            innerDiv.style.display 
= 'none';
        }
        
        
function Button1_onclick() {
            openNewWindow();
        }
</script>
</head>
<body>
    
<div id="container" style="filter: alpha(opacity=40); position: absolute; top: 0px;
        left: 0px; z-index: 9998; background: black"
>
    
</div>
    
<div id="content" style="height: 200px; width: 300px; position: absolute;
        display: none; z-index: 9999;"
>
        
<div style="text-align: center; background-color: Gray;border:solid 1px gray">
            
<iframe style="border-style: none; width: 100%; height: 100%;" frameborder="0">
            
</iframe>            
            
<button onclick="closeWindow();">
                close
</button>
        
</div>
    
</div>
    
<p>
        
<input id="Button1" type="button" value="button" onclick="return Button1_onclick()" /></p>
</body>
</html>