www.fgks.org   »   [go: up one dir, main page]

Click to Rate and Give Feedback
Properties
 menuArguments Property
menuArguments Property

Returns the window object in which the context menu item opened.

Syntax

[ oWindow = ] external.menuArguments

Possible Values

oWindow The object reference of the window where the context menu was opened.

The property is read-only. The property has no default value.

Remarks

This property is accessible by script handlers that are specified in the registry for a new context menu entry. When invoked as a menu extension, the menuArguments property returns an object reference to the window where the context menu was opened. The event object is exposed through this object reference, so that authors can query the srcElement property, the clientX property, and clientY property.

For more information about how to implement extensions to the Dynamic HTML (DHTML) Document Object Model (DOM), see About the Browser. For more information about how to add an entry into the standard context menus in Windows Internet Explorer, see Adding Entries to the Standard Context Menu.

This property is functionally identical to dialogArguments.

This property is not supported in HTML Applications.

Example

This example uses the menuArguments property to change selected text to uppercase, or to insert text if no text is selected.

<SCRIPT LANGUAGE = "JavaScript">

// Get the window object where the context menu was opened.
var oWindow = window.external.menuArguments;

// Get the document object exposed through oWindow.
var oDocument = oWindow.document;

// Get the selection from oDocument.
// in oDocument.
var oSelect = oDocument.selection;

// Create a TextRange from oSelect.
var oSelectRange = oSelect.createRange();

// Get the text of the selection.
var sNewText = oSelectRange.text;

// If nothing was selected, insert some text.
if (sNewText.length == 0){
   oSelectRange.text = "INSERT TEXT";
}

// Otherwise, convert the selection to uppercase.
else{
   oSelectRange.text = sNewText.toUpperCase();
}
</SCRIPT>

Standards Information

There is no public standard that applies to this property.

Applies To

external
Tags What's this?: Add a tag
Community Content
 
Add Community Content
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker
DCSIMG