I patched together code to grab a file from a url (stripped html) and
inject it into an IFrame for swappable layering. I still need it to pull
an onload default page though, but it has me scratching my head.
I tried <body onload=”loadOuter(‘main.html’)> but it morphed my layout
and just plain didn’t work in general. Any suggestions appreciated!
swaplayer.js
[code]
var srcFrame;
//External content into a layer
function loadOuter(doc) {
srcFrame = document.getElementById(“hiddenContent”);
srcFrame.src = doc;
// workaround for missing onLoad event in IFRAME for NN6
if (!srcFrame.onload) {
setTimeout(“transferHTML()”, 500)
}
}
function transferHTML(){
srcContent=”;
if (srcFrame.contentDocument){
srcContent=srcFrame.contentDocument.getElementsByTagName(“BODY”)[0].innerHTML;
}
else if (srcFrame.contentWindow){
srcContent=srcFrame.contentWindow.document.body.innerHTML;
}
document.getElementById(“outerDisplay”).innerHTML = srcContent
}
var DocAry=new Array(”);
function SelectList(v){
if (v>0){
loadOuter(DocAry[v-1]);
}
}
And HTML mechanism and injection site
[code]
<a href=”#” onClick=”loadOuter(‘main.html’)”>home.</a>
…..
<iframe id=”hiddenContent” width=”200″ height=”200″ style=”position:absolute;visibility:hidden;width:auto;height:auto;” ></iframe>