我现在想做一个效果,就是主页里面嵌套一个iframe,根据左边的菜单栏选择的内容不同,iframe内的页面随之改变,现在采用的方式是点击一个菜单,然后动态创建一个iframe,加载一个jsp页面,然后点击另一个菜单加载另一个页面,为了提高速度,采用
了动态创建和动态销毁iframe的方式,这样却导致了ie最后内存泄露
[code="java"]
//创建
var iframe = document.createElement("iframe");
iframe.src = pageURL;
document.getElementById("contentDiv").appendChild(iframe);
//销毁 tempFrame.src = blankPageURL;
tempFrame.contentWindow.document.write('');
tempFrame.contentWindow.document.clear();
tempFrame.contentWindow.close();
document.getElementById('contentDiv').removeChild(tempFrame);
tempFrame = null;
CollectGarbage();
[/code]
请问有什么好的解决方法或者其他的方案来实现???
今天又尝试了直接在html中使用iframe,然后动态通过iframe.src来改变页面的方式,又出现了另一个问题:点击一次可以加载出来,再点击一次又加载不出来了,然后再点击又可以加载出来,请问这是为什么????