http://msdn.microsoft.com/en-us/library/ms533723(v=vs.85).aspx
dialogArguments property
Gets the variable or array of variables passed into the modal dialog window.
Syntax
| JavaScript |
p = object.dialogArguments |
|---|
Property values
Type: Variant
the arguments that were passed when the dialog was created.
Remarks
The dialogArguments property>showModalDialog method >showModelessDialogmethod.
Examples
The following example shows how to get information passed into a modal dialog window by using the dialogArguments property. The code corresponds to two different files. One file launches the modal window and the other file stores the code for the modal window.
This file launches the modal window and then sends an object to that modal window.
<!DOCTYPE html>
<html>
<head>
<script>
function fnLaunch() {
var aForm;
aForm = document.getElementById('oForm').elements;
var myObject = new Object();
>// The object "myObject" is sent to the modal window.
window.showModalDialog("modalDialogSource.htm", myObject, "dialogHeight:300px; dialogLeft:200px;");
}
</script>
</head>
<body>
<button onclick="fnLaunch();">Launch The Dialog</button>
<form id="oForm">
First Name:
<input type="text" name="oFirstName" value="Jane">
<br>
Last Name:
<input type="text" name="oLastName" value="Smith">
</form>
</body>
</html>
This file (modalDialogSource.htm), stores the code for the modal window. Get the object sent to this modal window by using thedialogArguments property.
Code>http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/dialogArgumentsCallerEX1.htm
<!DOCTYPE html>
<html>
<head>
<script>
var oMyObject = window.dialogArguments;
var sFirstName = oMyObject.firstName;
var sLastName = oMyObject.lastName;
</script>
<title>dialogArguments</title>
</head>
<body style="font-family: arial; font-size: 14pt; color: Snow; background-color: RosyBrown;">
First Name:
<span style="color: 00ff7f">
<script>
document.write(sFirstName);
</script>
</span>
<br>
Last Name:
<span style="color: 00ff7f">
<script>
document.write(sLastName);
</script>
</span>
</body>
</html>
本文介绍如何使用dialogArguments属性在打开模态窗口时传递变量或变量数组,并通过示例展示了发送对象到模态窗口并获取该对象的过程。
1026

被折叠的 条评论
为什么被折叠?



