menuArguments Property

MS Office DHTML, HTML & CSS

menuArguments Property


Returns the window object where the context menu item was executed.

Syntax

HTMLN/A
Scripting[ oWindow = ] window.external.menuArguments

Possible Values

oWindowObject that specifies where the context menu was opened.

The property is read-only with no default value.

Remarks

This property is accessible only through script specified in the registry for a new context menu entry.

The menuArguments property returns an object reference of the window where the context menu was opened. The event object is exposed through this object reference, allowing authors to query the srcElement, clientX, and clientY properties.

For more information about how to implement extensions to the DHTML Object Model, see extending the dynamic html object modelInternet Link. For more information about how to add an entry into the standard context menus in Internet Explorer, see adding entries to the standard context menuInternet Link.

This property is not supported in html applicationsInternet Link.

Example

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

Sample Code

<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>

Applies To

[ Object Name ]
PlatformVersion
Win16:
Win32:
Mac:
Unix:
WinCE:
Version data is listed when the mouse hovers over a link, or the link has focus.
external

See Also

adding entries to the standard context menuInternet Link, extending the dynamic html object modelInternet Link

Back to topBack to top

Did you find this topic useful? Suggestions for other topics? write us!Internet Link

© 1999 microsoft corporation. all rights reserved. terms of useInternet Link.