最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

判斷目標(biāo)是否是window,document,和擁有tagName的Element的代碼

 更新時間:2010年05月31日 23:28:39   作者:  
判斷目標(biāo)是否是window,document,和擁有tagName的Element的代碼,需要的朋友可以參考下。
復(fù)制代碼 代碼如下:

function isWindow( obj )
{
if( typeof obj.closed == 'undefined' ) return false;
var result = /\[object (window|global)\]/i.test( Object.prototype.toString.call( obj ) );
if( result )return result;
try{
obj.closed = obj.closed;
return false;
}catch(e)
{
result = true;
}
return result;
}
function isDocument( obj )
{
if( typeof obj.body == 'undefined' ) return false;
var b = obj.body;
try{
obj.body = null;
obj.body = b;
return false;
}catch(e)
{
return true;
}
}
function isElement( o )
{
var tn = 'tagName',temp = o[tn],result;
if( typeof temp == 'undefined' )return false;
try{
o[tn] = null;
result = ( temp == o[tn] );
o[tn] = temp;
return result;
}catch(e)
{
return true;
}
}

function getOwnerWindow( node )
{
if( isWindow( node ) )return node;
var doc = isDocument( node ) ? node : node.ownerDocument;
return doc.view || doc.parentWindiw || doc.defaultView;
}

需要充分測試

相關(guān)文章

最新評論

湘潭县| 水富县| 孟津县| 松桃| 宿松县| 屯昌县| 邯郸市| 石台县| 峨山| 崇文区| 莒南县| 万年县| 沙洋县| 海阳市| 内黄县| 永丰县| 芦溪县| 玉环县| 敦煌市| 彰化县| 古浪县| 台南市| 皋兰县| 湟中县| 英德市| 郴州市| 万载县| 鹿泉市| 元阳县| 紫金县| 莱州市| 南涧| 开平市| 安福县| 吴旗县| 息烽县| 阳泉市| 宕昌县| 上林县| 鄂尔多斯市| 沙河市|