Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

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 applies only to windows that are created with the showModalDialog method and the showModelessDialog method.

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();
      myObject.firstName = aForm.oFirstName.value;
      myObject.lastName = aForm.oLastName.value;
      // 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 the dialogArguments property.

Code example: 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>

See also

window

 

 

Show:
© 2017 Microsoft