比如说
var obj;
obj=window.document.getElementById("div1");
或者
obj=window.parent.document.getElementById("div1");我需要一个方法返回obj说在的窗体windowfunction GetWindow(obj)
{
return ?
//当obj=window.document.getElementById("div1"); 应该返回 window
//当obj=window.parent.document.getElementById("div1"); 应该返回window.parent
}
var obj;
obj=window.document.getElementById("div1");
或者
obj=window.parent.document.getElementById("div1");我需要一个方法返回obj说在的窗体windowfunction GetWindow(obj)
{
return ?
//当obj=window.document.getElementById("div1"); 应该返回 window
//当obj=window.parent.document.getElementById("div1"); 应该返回window.parent
}
function GetWindow(obj)
{
var doc=obj.ownerDocument;//获取obj关联的document对象
var w=doc.parentWindow;//获取document对象所在窗口的引用
return w;
}