查找所有嵌套iframe

 

//查找所有嵌套iframevar allIfrs = new Array();
function findAllIfr(ifr){
	var ct = ifr;
	if(ifr != top)
		ct = ifr.contentWindow;
	var ifrs = ct.document.getElementsByTagName("iframe");
	for(var i=0; i<ifrs.length; i++){
		allIfrs[allIfrs.length] = ifrs[i];
		findAllIfr(ifrs[i]);
	}
}
// 强制退出无论是否存在未保存单据
function forceLogout(){
	// 查找所有iframe
	findAllIfr(top);
	
	for(var i=0; i<allIfrs.length; i++){
		if(allIfrs[i].toft && allIfrs[i].toft.setChanged)
			allIfrs[i].toft.setChanged("0");
	}
	
	if(!top.ca_logoutPath)
		top.ca_logoutPath = "/xxx/logout.do";
	location.href=top.ca_logoutPath;
}


 

你可能感兴趣的:(查找所有嵌套iframe)