代码改变世界

【javascript】JS的window.createPopup()

2012-07-12 13:57  sniper007  阅读(787)  评论(0编辑  收藏  举报

JS的window.createPopup()学习

function OpenShortcutMenu( domObj )
{
var pop = window.createPopup();
var popBody = pop.document.body;
popBody.innerHTML = "Testing..."
pop.show(window.event.x, 76, 140,200, document.body);
}


(1)var pop 变量:

popup 对象

一种特殊的顶层窗口,主要用于出现在应用程序主窗口之外的对话框、消息框和其它临时窗口。

注释:此对象在 Microsoft® Internet Explorer 5.5 的脚本中可用。


(2)window.createPopup() 方法:

createPopup Method

Creates a popup window.

Syntax

oPopup = window.createPopup( [vArgs])

Parameters

vArgs
Optional. This argument is reserved for future use.

Return Value

Returns the popup window object.

Remarks

The pop-up window is initially in a hidden state.

When an element has focus and causes a popup to appear, the element does not lose focus. Because of this, an onblur event associated with an element that creates a popup will not occur when the popup is displayed.


(3)popup的document属性

document Property

Retrieves the HTML document in a given popup window.

Syntax

[ oDocument = ] popup.document

Possible Values

oDocument
Object that receives the document object of the pop-up window.

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


()pop.show(...)方法:

show Method

Displays the pop-up window on the screen.

Syntax

popup.show(iX, iY, iWidth, iHeight [, oElement])

Parameters

iX
Required. Integer that specifies the x-coordinate of the pop-up window, in pixels.

iY
Required. Integer that specifies the y-coordinate of the pop-up window, in pixels.

iWidth
Required. Integer that specifies the width of the pop-up window, in pixels.

iHeight
Required. Integer that specifies the height of the pop-up window, in pixels.

oElement
Optional. Object that specifies the element to which the x,y coordinates are relative. If none is given, the x,y coordinates are relative to the desktop, where (0,0) is the upper left corner.

Return Value

No return value.