A major force behind DHTML has been the requirement to update page contents dynamically.
Structured, document-based updating of parts of the display page has traditionally been done using Frames and FrameSets.
The technique demonstrated here uses some javascript functions to replace a targetted DIV on the page with the contents of some external document loaded into an invisible anonymous IFRAME element.
The ctcutils.js contains a javascript method called rpc, here
is the definition:
var g_iframe = null;
function rpc(targetURL) {
if (g_iframe == null) {
iframeHTML='<iframe id="rpcFrame"
style="border:0px;width:0px;height:0px;"></iframe>';
document.body.innerHTML += iframeHTML;
g_iframe = document.getElementById('rpcFrame');
}
g_iframe.src = targetURL;
return false;
}
You should be able to see that calling the rpc function with a valid
URL will load the contents of the document into the iframe.
Once you have this idea, then there are a number of things that can be done, and the
protocol demonstrated here - also in ctcutils.js is only a suggestion.
var g_dstID = null;
function rpcGrab(targetURL, dstID) {
g_dstID = dstID;
return rpc(targetURL);
}
function rpcReturn(html) {
// document.getElementById(g_dstID).innerHTML = html;
g_dstID.innerHTML = html;
}
Then, in the document that is to be loaded - and this is where you'll need some co-operation -
<html>
<body
onLoad='window.parent.rpcReturn(document.body.innerHTML);'>
...
Alternatively it should be possible to poll the document load state, in which case it would not be necessary for co-operation of the target. But, in any case, the example here uses the protocols as described.
But....
Check this out.