次の方法で共有


System.Gadget.document property

[The Windows Gadget Platform/Sidebar is available for use in the operating systems specified in the Requirements section. It may be altered or unavailable in subsequent versions. ]

Gets an object that represents the Document Object Model (DOM) of the gadget HTML file.

This property is read-only.

Syntax

objdocument = System.Gadget.document

Property value

An Object that receives the gadget DOM.

Remarks

Equivalent to the JavaScript object.

Facilitates interaction between the main gadget window and a gadget Flyout by providing the ability to modify the other window's DOM and trigger events.

Examples

The following example demonstrates how to use the document object to update the gadget DOM from a gadget Flyout.

The gadget HTML file.

<body onload="Init();">
<g:background id="imgBackground" src="url(images/background.png)" />
<div id="gadgetContent">
<a id="aFlyout" href="javascript:void(0);" onclick="showFlyout();">Show Flyout</a><br />
<span id="sFlyoutFeedback"></span>
</div>
</body>

The gadget Flyout HTML file.

<body>
<g:background id="imgBackground" src="url(images/background.png)" />
<div id="flyoutContent">
<a href="javascript:void(0);" onclick="hideFlyout();">Hide Flyout</a><br />
<input type="text" id="txtFeedback" onkeyup="showInGadget(this);" />
</div>
</body>

The gadget Flyout script file.

var oGadgetDocument = System.Gadget.document;

// --------------------------------------------------------------------
// Hide the flyout.
// --------------------------------------------------------------------
function hideFlyout()
{
    System.Gadget.Flyout.show = false;
}

// --------------------------------------------------------------------
// Display the Flyout user input in the gadget.
// --------------------------------------------------------------------
function showInGadget(userInput)
{
    oGadgetDocument.getElementById("sFlyoutFeedback").innerText = userInput.value;
}

Requirements

Minimum supported client
Windows Vista [desktop apps only]
Minimum supported server
Windows Server 2008 [desktop apps only]
End of client support
Windows 7
End of server support
Windows Server 2008
IDL
Sidebar.idl
DLL
Sidebar.Exe (version 1.00 or later)