showModalDialog函数的使用
来源:互联网 发布:高通量人工智能一体机 编辑:程序博客网 时间:2024/05/14 08:48
本范例可以实现弹出一个模态窗口,并演示了两种接收和传递参数的方法,同时可以接受模态窗口返回的多个变量
showModalDialog帮助可以参阅微软MSDN http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/showmodaldialog.asp
AA.HTM
--------------------------------------------------------------------------------------------------------------------------
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>主界面</title>
</head>
<body>
<form id="getForm"> 回传值:<input type="text" id="getData" readOnly> <input type="text" id="getData1" readOnly>
</form>
<input type="button" value="打开新窗口1" onClick="openWin1()">
<input type="button" value="打开新窗口2" onClick="openWin2()">
<script language="JavaScript">
function openWin1()
{
var srcFile = "BB.htm"; //新窗口的文档名称
var winFeatures = "dialogHeight:300px; dialogLeft:200px;";
var obj = getForm; //将form作为对象传递给新窗口
window.showModalDialog(srcFile, obj, winFeatures);
}
function openWin2()
{
var srcFile = "CC.htm"; //新窗口的文档名称
var winFeatures = "dialogHeight:300px; dialogLeft:200px;";
var obj = getForm.getData.value; //将form作为对象传递给新窗口
var str=window.showModalDialog(srcFile, obj, winFeatures);
if(str!=null)
document.getForm.getData.value = str;
}
</script>
</body>
</html>
BB.HTM
重要提示:你弹出窗口中调用的是ASPX文件时,必须在Page_Load事件中加入以下代码
Response.Expires = 0; Response.Cache.SetNoStore(); Response.AppendHeader("Pragma", "no-cache");
否则,每次弹出的页面都是上一次的Cache,不会改变。
------------------------------------------------------------------------------------------------------------------------
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新窗口BB</title>
</head>
<base target="_self"> <!--这句话非常重要,只要加上才能保证在弹出窗口中调用服务端代码而不会再弹出一个新窗口-->
<body>
<form id="sendForm"> 请输入资料:
<input type="text" id="writeData">
<input type="text" id="writeData1">
<input type="button" value="送回父窗口" onClick="send(sendForm.writeData.value,sendForm.writeData1.value);">
</form>
<script language="JavaScript">
function send(val,val1)
{
//取得父窗口传过来的对象
var myObj = window.dialogArguments;
//赋值
myObj.getData.value = val;
myObj.getData1.value = val1;
//关闭窗口
window.close();
}
</script>
</body>
</html>
CC.HTM
------------------------------------------------------------------------------------------------------------------------
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新窗口CC</title>
</head>
<base target="_self"> <!--这句话非常重要,只要加上才能保证在弹出窗口中调用服务端代码而不会再弹出一个新窗口-->
<body>
<form id="sendForm"> 请输入资料:
<input type="text" id="writeData">
<input type="button" value="送回父窗口" onClick="send(sendForm.writeData.value);">
</form>
<script language="JavaScript">
function send(val)
{
window.returnValue=val
window.close();
}
</script>
</body>
</html>
原文链接 http://xujh.cnblogs.com/archive/2005/04/20/141440.html
- showModalDialog函数的使用
- ShowModalDialog函数的功能:
- showModalDialog的使用
- showModalDialog 命令的使用
- window.showModalDialog的使用
- showModalDialog的使用
- Window.ShowModalDialog的使用
- showModalDialog的详细使用
- showModalDialog,showModelessDialog的使用
- showModalDialog 的使用
- window.showmodaldialog的使用
- JS解决chrome37+ window.showmodaldialog函数不能使用的问题
- ShowModalDialog函数的简单介绍
- showModalDialog和showModelessDialog的使用
- 过时的showModalDialog使用--传值
- showModalDialog 使用的问题总结
- 关于window.showmodaldialog的使用
- JS中ShowModalDialog函数使用小记
- 场地驾驶考试科目操作教程(参考)
- Linux服务器教程之路6——DNS服务器的配置
- 如何点击按钮弹出新窗口,输入数据后返回并刷新页面?(C#代码)
- linux网络命令大全
- 不使用installutil.exe安装WINDOWS服务
- showModalDialog函数的使用
- 如何学习Linux服务器——写给Windows下的用户
- 从WEB SERVICE 上返回大数据量的DATASET
- ASP.NET2.0: Ilungasoft.Framework.Web之基于Callback的无刷新上传进度条控件[带源码]
- showModalDialog()、showModelessDialog()方法使用详解
- OleDbCommand 是当前正忙的Open, Fetching
- 2006年F1第四站意大利圣马利诺
- jdk1.5+apache-tomcat-5.5安装心得
- 坡上起步体会和经验