msdn的例子<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Example of the showModelessDialog Method</TITLE><META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=iso-8859-1">
<META NAME="AUTHOR" CONTENT="InetSDK">
<META NAME="MS.LOCALE" CONTENT="EN-US">
<META NAME="ROBOTS" CONTENT="noindex"><!-- STYLE_START -->
<LINK REL="stylesheet" HREF="../../../../../workshop/basicsdkie4.css" TYPE="text/css">
<LINK REL="stylesheet" HREF="../../../../../workshop/advsdkie4.css" TYPE="text/css">
<!-- STYLE_END --><SCRIPT DEFER SRC="../../../../../workshop/code/common.js"></SCRIPT>
<SCRIPT DEFER SRC="../../../../../msdn-online/shared/js/toc.js"></SCRIPT>
<SCRIPT>
// All code in this script tag belongs to showModelessDialog sample.var sUserName=""; // Supplies a return value from modeless dialog box
var oDialog = "myDialog.htm"; // Passes URL and filename of dialog box as a variable
var bDialogStatus = false; // Indicates whether modeless dialog box is currently open/*------------------------------------------------------------The fnCallDialog function invokes showModelessDialog passing the following parameters:
sURL: oDialog
vArguments: window
sFeatures: status and dialog*Supplying the window object as a parameter allows for declaring the global variable, sUserName, and using it to return information from the modeless dialog box.The Boolean bDialogStatus enables a check for whether the modeless dialog box is already open.
If it is already open, then the browser gives it focus rather than opening another instance
of the dialog box.
------------------------------------------------------------- */function fnCallDialog()
{
showModelessDialog(oDialog,window,"status:false;dialogWidth:300px;dialogHeight:300px");
}/* Reed out until RTM when focus is implemented on modeless dialog boxes.
if ( bDialogStatus == false )
{
showModelessDialog(oDialog,window,"status:false;dialogWidth:300px;dialogHeight:300px");
bDialogStatus = true;
}
else
oDialog.focus();
*//*-------------------------------------------------------------The fnUpdate function takes the value passed into sUserName in myDialog.htm to update
the span text on this page. This function is called in both fnGetInfo and fnCancel
functions in myDialog.htm.
-------------------------------------------------------------*/function fnUpdate()
{
oName.innerText = sUserName;
}</SCRIPT>
</HEAD>
<!--TOOLBAR_START-->
<!--TOOLBAR_EXEMPT-->
<!--TOOLBAR_END--><BODY TOPMARGIN=0 LEFTMARGIN=0 BGPROPERTIES="FIXED" BGCOLOR="#FFFFFF"
LINK="#000000" VLINK="#808080" ALINK="#000000">
<BLOCKQUOTE CLASS="body"><!-- CONTENTS_START -->
<H1>Example of the showModelessDialog Method</H1>
<P>This page demonstrates the Internet Explorer modeless dialog box. Click the button to open the modeless dialog box.</P>
<P>When showModelessDialog is invoked, the window object is passed as the second argument. Doing so enables the creation of a global variable that can be used to supply a return value. The return value is passed using the dialogArguments parameter from the modeless dialog box back to the window that called it.</P>
<BR>
<P>Enter your first name: <SPAN ID="oName" STYLE="color:red;font-size:24">Joan</SPAN></P>
<INPUT TYPE="button" VALUE="Display Modeless Dialog" onclick="fnCallDialog()"><BR><BR><!-- CONTENTS_END --><!-- START_PAGE_FOOTER -->
<BR><BR><BR>
© <A CLASS="clsIncCpyRt" HREF="http://msdn.microsoft.com/isapi/gomscom.asp?target=/misc/cpyright.htm" TARGET="_top">2000 Microsoft Corporation. All rights reserved. Terms of use</A>.
<!-- END_PAGE_FOOTER -->
</BLOCKQUOTE>
</BODY>
</HTML><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>untitled</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=iso-8859-1">
<META NAME="AUTHOR" CONTENT="InetSDK">
<META NAME="MS.LOCALE" CONTENT="EN-US">
<META NAME="ROBOTS" CONTENT="noindex"><SCRIPT>/* -------------------------------------------------------------
This function makes use of the dialogArguments property of the
window object. dialogArguments allows the global variable sUserName
to feed the value supplied to the input in this dialog box back to
the window that called it.
---------------------------------------------------------------- */function fnGetInfo()
{
var sData = dialogArguments;
sData.sUserName = oEnterName.value;
sData.fnUpdate();
}/* -------------------------------------------------------------
This function cleans up in case the user has clicked the
Apply button before canceling.
---------------------------------------------------------------- */function fnCancel()
{
var sData = dialogArguments;
sData.sUserName = "Joan";
sData.fnUpdate();
}
</SCRIPT>
下面是myDialog.htm的
<!-- SAMPLE_STYLE_START -->
<LINK REL="stylesheet" HREF="../../../../../workshop/basicsdkie4.css"
TYPE="text/css">
<!-- SAMPLE_STYLE_END -->
</HEAD>
<!--TOOLBAR_START-->
<!--TOOLBAR_EXEMPT-->
<!--TOOLBAR_END--><BODY onbeforeunload="bDialogStatus=false" STYLE="padding:10" TOPMARGIN=0 LEFTMARGIN=0 BGPROPERTIES="FIXED" BGCOLOR="#FFFFFF"
LINK="#000000" VLINK="#808080" ALINK="#000000">
<BLOCKQUOTE CLASS="body"><LABEL FOR="oEnterName" ACCESSKEY="f">Enter your <SPAN STYLE="text-decoration:underline">F</SPAN>irst Name</LABEL>
<INPUT ID=oEnterName><BR><BR>
<INPUT VALUE="Apply" TYPE=button onclick="fnGetInfo();">
<INPUT VALUE="Ok" TYPE=button onclick="fnGetInfo();window.close();">
<INPUT VALUE="Cancel" TYPE=button onclick="fnCancel();window.close();"><!-- START_PAGE_FOOTER -->
<!--@ File doesn't require CR statement-->
<!-- END_PAGE_FOOTER -->
</BLOCKQUOTE>
</BODY>
</HTML>
<HTML>
<HEAD>
<TITLE>Example of the showModelessDialog Method</TITLE><META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=iso-8859-1">
<META NAME="AUTHOR" CONTENT="InetSDK">
<META NAME="MS.LOCALE" CONTENT="EN-US">
<META NAME="ROBOTS" CONTENT="noindex"><!-- STYLE_START -->
<LINK REL="stylesheet" HREF="../../../../../workshop/basicsdkie4.css" TYPE="text/css">
<LINK REL="stylesheet" HREF="../../../../../workshop/advsdkie4.css" TYPE="text/css">
<!-- STYLE_END --><SCRIPT DEFER SRC="../../../../../workshop/code/common.js"></SCRIPT>
<SCRIPT DEFER SRC="../../../../../msdn-online/shared/js/toc.js"></SCRIPT>
<SCRIPT>
// All code in this script tag belongs to showModelessDialog sample.var sUserName=""; // Supplies a return value from modeless dialog box
var oDialog = "myDialog.htm"; // Passes URL and filename of dialog box as a variable
var bDialogStatus = false; // Indicates whether modeless dialog box is currently open/*------------------------------------------------------------The fnCallDialog function invokes showModelessDialog passing the following parameters:
sURL: oDialog
vArguments: window
sFeatures: status and dialog*Supplying the window object as a parameter allows for declaring the global variable, sUserName, and using it to return information from the modeless dialog box.The Boolean bDialogStatus enables a check for whether the modeless dialog box is already open.
If it is already open, then the browser gives it focus rather than opening another instance
of the dialog box.
------------------------------------------------------------- */function fnCallDialog()
{
showModelessDialog(oDialog,window,"status:false;dialogWidth:300px;dialogHeight:300px");
}/* Reed out until RTM when focus is implemented on modeless dialog boxes.
if ( bDialogStatus == false )
{
showModelessDialog(oDialog,window,"status:false;dialogWidth:300px;dialogHeight:300px");
bDialogStatus = true;
}
else
oDialog.focus();
*//*-------------------------------------------------------------The fnUpdate function takes the value passed into sUserName in myDialog.htm to update
the span text on this page. This function is called in both fnGetInfo and fnCancel
functions in myDialog.htm.
-------------------------------------------------------------*/function fnUpdate()
{
oName.innerText = sUserName;
}</SCRIPT>
</HEAD>
<!--TOOLBAR_START-->
<!--TOOLBAR_EXEMPT-->
<!--TOOLBAR_END--><BODY TOPMARGIN=0 LEFTMARGIN=0 BGPROPERTIES="FIXED" BGCOLOR="#FFFFFF"
LINK="#000000" VLINK="#808080" ALINK="#000000">
<BLOCKQUOTE CLASS="body"><!-- CONTENTS_START -->
<H1>Example of the showModelessDialog Method</H1>
<P>This page demonstrates the Internet Explorer modeless dialog box. Click the button to open the modeless dialog box.</P>
<P>When showModelessDialog is invoked, the window object is passed as the second argument. Doing so enables the creation of a global variable that can be used to supply a return value. The return value is passed using the dialogArguments parameter from the modeless dialog box back to the window that called it.</P>
<BR>
<P>Enter your first name: <SPAN ID="oName" STYLE="color:red;font-size:24">Joan</SPAN></P>
<INPUT TYPE="button" VALUE="Display Modeless Dialog" onclick="fnCallDialog()"><BR><BR><!-- CONTENTS_END --><!-- START_PAGE_FOOTER -->
<BR><BR><BR>
© <A CLASS="clsIncCpyRt" HREF="http://msdn.microsoft.com/isapi/gomscom.asp?target=/misc/cpyright.htm" TARGET="_top">2000 Microsoft Corporation. All rights reserved. Terms of use</A>.
<!-- END_PAGE_FOOTER -->
</BLOCKQUOTE>
</BODY>
</HTML><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>untitled</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=iso-8859-1">
<META NAME="AUTHOR" CONTENT="InetSDK">
<META NAME="MS.LOCALE" CONTENT="EN-US">
<META NAME="ROBOTS" CONTENT="noindex"><SCRIPT>/* -------------------------------------------------------------
This function makes use of the dialogArguments property of the
window object. dialogArguments allows the global variable sUserName
to feed the value supplied to the input in this dialog box back to
the window that called it.
---------------------------------------------------------------- */function fnGetInfo()
{
var sData = dialogArguments;
sData.sUserName = oEnterName.value;
sData.fnUpdate();
}/* -------------------------------------------------------------
This function cleans up in case the user has clicked the
Apply button before canceling.
---------------------------------------------------------------- */function fnCancel()
{
var sData = dialogArguments;
sData.sUserName = "Joan";
sData.fnUpdate();
}
</SCRIPT>
下面是myDialog.htm的
<!-- SAMPLE_STYLE_START -->
<LINK REL="stylesheet" HREF="../../../../../workshop/basicsdkie4.css"
TYPE="text/css">
<!-- SAMPLE_STYLE_END -->
</HEAD>
<!--TOOLBAR_START-->
<!--TOOLBAR_EXEMPT-->
<!--TOOLBAR_END--><BODY onbeforeunload="bDialogStatus=false" STYLE="padding:10" TOPMARGIN=0 LEFTMARGIN=0 BGPROPERTIES="FIXED" BGCOLOR="#FFFFFF"
LINK="#000000" VLINK="#808080" ALINK="#000000">
<BLOCKQUOTE CLASS="body"><LABEL FOR="oEnterName" ACCESSKEY="f">Enter your <SPAN STYLE="text-decoration:underline">F</SPAN>irst Name</LABEL>
<INPUT ID=oEnterName><BR><BR>
<INPUT VALUE="Apply" TYPE=button onclick="fnGetInfo();">
<INPUT VALUE="Ok" TYPE=button onclick="fnGetInfo();window.close();">
<INPUT VALUE="Cancel" TYPE=button onclick="fnCancel();window.close();"><!-- START_PAGE_FOOTER -->
<!--@ File doesn't require CR statement-->
<!-- END_PAGE_FOOTER -->
</BLOCKQUOTE>
</BODY>
</HTML>
解决方案 »
- javascript的几种效果,请教自动判断与浏览器上端的边距,需要支持firefox
- 用javascript自动创建的一个img被网页上其他一个控件遮盖住了,怎么显示它?
- 为什么我的网站在google里搜出来的是乱码??急!!在线等!!!
- 在textarea中显示html页面
- 请问那里有javascript做的用户在文本筐中编辑的源码?
- 买树,请买树者foolfish (呆鱼) 进来
- 如何通过验证表单中的所有域不为空
- 主页面中怎样控制 IFrame中的网页中的元素及脚本
- 怎么样在javascript中得到当前窗口的高和宽呢???在线等待
- 最近用js做了一个简单年会抽奖系统
- 关于层div选择后传递数据的问题
- 高难度,挑战性问题———关于从数据库中读字段值、把读出的值作为下拉菜单选项的问题(100)
}
里面把window这个对象作为参数传给对话框,在对话框里面使用dialogArguments来引用传来的window对象(实参,形参),所以调用
var sData = dialogArguments;
sData.sUserName = "Joan";
就是修改了原来网页的sUserName;
sData.fnUpdate();
就是调用原来的网页的fnUpdate来更新的。
介绍:提供全套影视链接维护,设置。电影发布修改等功能,全部动态,纯ASP代码编写。
软件网站:http://www.buy57.com
http://www.buy57.com/down/buy57.com.rar
软件类型:国产软件 / 简体中文 / 共享软件
应用平台:Win95/98/NT/2000/XP