求弹出子窗口之后,父窗口不能动的代码 求弹出子窗口之后,父窗口不能动的代码。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <a href="#" onclick="popup()"><script type="text/javascript"> <!-- function popup() { var width=640; var height=580; window.showModalDialog('addPersonnel.aspx' ,window,'dialogWidth='+width+'px;dialogHeight='+ height+'px;resizable=no;help=no;center=yes;status=no;edge=sunken'); } // --> </script> 弹出模式窗口<script language="javascript"> function popupkind(xdm) { url="ThisTerm2Add.aspx?xdm="+xdm hr=window.showModalDialog(url,'',"dialogHeight:300px;dialogWidth:300px;dialogLeft:60px;dialogTop:30px;center:1;status:1;title:0;") } </script> window.showModalDialog("yourChildWindow.html"); 弹出模式对话框,假如程序需要多少调用,可以把它写成方法,传入参数就可以实现。 /// <summary> /// 打开指定大小位置的模式对话框 /// </summary> /// <param name="url"></param> /// <param name="width"></param> /// <param name="height"></param> /// <param name="top"></param> /// <param name="left"></param> public static void ShowModalDialog(string url, int width, int height, int top, int left) { string features = "dialogWidth:" + width.ToString() + "px" + ";dialogHeight:" + height.ToString() + "px" + ";dialogLeft:" + left.ToString() + "px" + ";dialogTop:" + top.ToString() + "px" + ";center:yes;help=no;resizable:no;status:no;scroll=yes"; string js = @"<script language=javascript> showModalDialog('" + url + "','','" + features + "');</script>"; HttpContext.Current.Response.Write(js); } 父窗口要求看到吗?如果是可以用div覆盖在父窗口上,使之变成灰色。如果不是可以直接关掉父窗口。 最简单的 做法 也可以很复杂 用层iframe等 showModalDialog() 弹出就不能动 window.showModalDialog()模式窗口就它了… <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head> <title>点击弹出对话框且背景变暗的效果</title> <meta http-equiv="content-type" content="text/html;charset=gb2312"> <link href="StyleSheet.css" rel="stylesheet" type="text/css" /> <script language="javascript"> function locking() { document.all.ly.style.display="block"; document.all.ly.style.width=document.body.clientWidth; //设置层1宽度等于body宽度,width=100%也可以,不过有一些误差,所以最好用这个 document.all.ly.style.height=document.body.clientHeight; //设置层1高度满屏 document.all.Layer2.style.display='block'; document.all.Layer2.style.top = document.body.clientHeight/2-document .getElementById ("Layer2").clientHeight/2//设置层2的距顶位置居中算法 document.all.Layer2.style.left = document.body.clientWidth/2-document .getElementById ("Layer2").clientWidth/2;//设置层2的距左位置居中算法 } function Lock_CheckForm(theForm) { document.all.ly.style.display='none'; document.all.Layer2.style.display='none'; } </script></head><body> <p> <input type="button" value="弹出窗口" onclick="locking();"></p> <!--这是要覆盖网页的层1,不必写任何东西--> <div id="ly"> </div> <!--浮层2框架开始--> <div id="Layer2"> <div class="msg_title"> <a href="#" class="myfont" onclick="Lock_CheckForm(this);">[关闭]</a></div> <div class="msg_content"> <p> 确定退出?</p> <p> <input type="button" value="确定" /> <input type="button" onclick="showclose();" value="取消" /></p> </div> </div> <!--浮层2框架结束--></body></html>a:link{ color: #FFFFFF; text-decoration: none;}a:visited, a:hover, a:active{ text-decoration: none;}.myfont{ font-size: 12px;}#ly{ position: absolute; top: 0px; filter: alpha(opacity=60); background-color: #777; z-index: 2; left: 0px; display: none;}#Layer2{ position: absolute; z-index: 3; background-color: #fff; display: none; width: 540px; height: 300px;}.msg_title{ border: 1px solid #2982BA; background-color: #ADDAFB; border-bottom: 0; text-align: right; vertical-align: bottom; cursor :move; /*设置指针的移动图标,若不想移动,可以去掉此行*/ /*与height大小一样可以垂直居中,适用于单行情况*/ height: 25px; line-height: 25px; overflow: hidden; /*与height大小一样可以垂直居中,适用于单行情况*/}.msg_content{ border: 1px solid #2982BA; background-color: #E6F7FF; text-align: center; height: 275px; padding-top: 50px;} 用showModalDialog来弹出页面,这样就形成了一个遮罩的效果 到底什么事asp.net? 根据子页面操作masterpage的问题 穷人图片问题,望孟子等指教, 大家一起来帮忙解决下这问题,急,在线等 [[[[[[[[[[[[[[[[[[高手来看看啊,顶者有分 asp中有没有转义字符? 如何不在本地机上添加类库项目? 有工作经验的请进来,我需要你们的建议! 简单的问题!怎么将一个页面的底部显示在浏览器的中央位置(在BUTTON的单击事件处理函数中) 我的ASP。NET的应用程序的控件显示问题! 求UpdatePanel和UpdateProgress实现数据加载等待效果 上传图片重复问题
<!--
function popup()
{
var width=640;
var height=580;
window.showModalDialog('addPersonnel.aspx' ,window,'dialogWidth='+width+'px;dialogHeight='+ height+'px;resizable=no;help=no;center=yes;status=no;edge=sunken');
}
// -->
</script>
function popupkind(xdm)
{
url="ThisTerm2Add.aspx?xdm="+xdm
hr=window.showModalDialog(url,'',"dialogHeight:300px;dialogWidth:300px;dialogLeft:60px;dialogTop:30px;center:1;status:1;title:0;")
}
</script>
/// 打开指定大小位置的模式对话框
/// </summary>
/// <param name="url"></param>
/// <param name="width"></param>
/// <param name="height"></param>
/// <param name="top"></param>
/// <param name="left"></param>
public static void ShowModalDialog(string url, int width, int height, int top, int left)
{
string features = "dialogWidth:" + width.ToString() + "px"
+ ";dialogHeight:" + height.ToString() + "px"
+ ";dialogLeft:" + left.ToString() + "px"
+ ";dialogTop:" + top.ToString() + "px"
+ ";center:yes;help=no;resizable:no;status:no;scroll=yes";
string js = @"<script language=javascript>
showModalDialog('" + url + "','','" + features + "');</script>";
HttpContext.Current.Response.Write(js);
}
如果不是可以直接关掉父窗口。
<html>
<head>
<title>点击弹出对话框且背景变暗的效果</title>
<meta http-equiv="content-type" content="text/html;charset=gb2312">
<link href="StyleSheet.css" rel="stylesheet" type="text/css" /> <script language="javascript">
function locking()
{
document.all.ly.style.display="block";
document.all.ly.style.width=document.body.clientWidth; //设置层1宽度等于body宽度,width=100%也可以,不过有一些误差,所以最好用这个
document.all.ly.style.height=document.body.clientHeight; //设置层1高度满屏
document.all.Layer2.style.display='block';
document.all.Layer2.style.top = document.body.clientHeight/2-document .getElementById ("Layer2").clientHeight/2//设置层2的距顶位置居中算法
document.all.Layer2.style.left = document.body.clientWidth/2-document .getElementById ("Layer2").clientWidth/2;//设置层2的距左位置居中算法
}
function Lock_CheckForm(theForm)
{
document.all.ly.style.display='none';
document.all.Layer2.style.display='none';
}
</script></head>
<body>
<p>
<input type="button" value="弹出窗口" onclick="locking();"></p>
<!--这是要覆盖网页的层1,不必写任何东西-->
<div id="ly">
</div>
<!--浮层2框架开始-->
<div id="Layer2">
<div class="msg_title">
<a href="#" class="myfont" onclick="Lock_CheckForm(this);">[关闭]</a></div>
<div class="msg_content">
<p>
确定退出?</p>
<p>
<input type="button" value="确定" />
<input type="button" onclick="showclose();" value="取消" /></p>
</div>
</div>
<!--浮层2框架结束-->
</body>
</html>a:link
{
color: #FFFFFF;
text-decoration: none;
}
a:visited, a:hover, a:active
{
text-decoration: none;
}
.myfont
{
font-size: 12px;
}#ly
{
position: absolute;
top: 0px;
filter: alpha(opacity=60);
background-color: #777;
z-index: 2;
left: 0px;
display: none;
}#Layer2
{
position: absolute;
z-index: 3;
background-color: #fff;
display: none;
width: 540px;
height: 300px;
}.msg_title
{
border: 1px solid #2982BA;
background-color: #ADDAFB;
border-bottom: 0;
text-align: right;
vertical-align: bottom;
cursor :move; /*设置指针的移动图标,若不想移动,可以去掉此行*/
/*与height大小一样可以垂直居中,适用于单行情况*/
height: 25px;
line-height: 25px;
overflow: hidden;
/*与height大小一样可以垂直居中,适用于单行情况*/
}.msg_content
{
border: 1px solid #2982BA;
background-color: #E6F7FF;
text-align: center;
height: 275px;
padding-top: 50px;
}