div 按 id 刷新 需要jquery

代码一:

 

<div id="mainContent">

<iframe id="contentContainer" name="mainFrame" width="100%" frameborder="0" scrolling="auto" height="700"
					src="">
</iframe>
</div>

 

代码二:

 

function refreshMainContent(url,path,showLoading,language,locale)
{
	var action=url;

	if(url.indexOf('{')==0&&url.lastIndexOf('}')==url.length-1){
		
	}

	var mainContent = document.getElementById("mainContent");
	if (mainContent)
	{
		// Remove iframe in mainContent
		var jqIframe = jQuery('#mainContent').find("iframe");
		jqIframe.attr("src", "about:blank");
		try{//Try is for sub-window access deny(security problem).
		    jqIframe.contents().each(function()
		    {//Prevent Memory Leak
			    this.write("");
		    });
		}catch(e){}
		jqIframe.remove();

		mainContent.innerHTML = "";
	}

	jQuery("#mainContent").load(action,"",function(){
		
	});
	
	return false;
}




posted @ 2014-10-07 00:25  雪来了  阅读(552)  评论(0编辑  收藏  举报