var temp_iframe
var content = document.getelementbyid('right'); //id為 right的dom容器中,進行創建iframe和寬高自我調整
var c = 0 ;
function append(filename)
{
var the_iframe = "helpfile" + c;
temp_iframe = document.createelement("iframe");
temp_iframe.src = filename;
temp_iframe.scrolling = "no";
temp_iframe.setattribute("frameborder", "0");
temp_iframe.id = the_iframe;
temp_iframe.name = the_iframe;
scroll(0, 0);
content.innerhtml = "";
content.appendchild(temp_iframe);
if (document.all)
{
temp_iframe.attachevent('onload', function()
{
temp_iframe.setattribute("wid th", window.frames[the_iframe].document.body.scrollwidth); 自我調整寬
temp_iframe.setattribute("height", window.frames[the_iframe].document.body.scrollheight); //自我調整高
}) ;
}
else
{
temp_iframe.addeventlistener('load', function()
{
temp_iframe.setattribute("width", window.frames[the_iframe].document.body.scrollwidth);
temp_iframe.setattribute("height", window.frames[the_iframe].document.body.scrollheight);
}, false);
}
c++;
return false;
}
/*調用方法
把此腳本另存為指令檔:iframe.網頁特效,然後再前臺頁面中調用:
---------------------------------------------------- --------------------
<a href="index.html" onclick="return append('xxxx.html')" class="li1">
<div id="right"></div>
<script type="text/網頁特效" src="iframe.網頁特效"></script>
------------------------------------------------------------------------
或者 去掉腳本中最後的 return false,前臺:
------------------------------------------------------------------------
<a href="網頁特效:append('favorite/favorites.html')" class="li1">
<div id="right"></div>
<script type="text/javascript" src="iframe.js"></script>