F
Floris van den Berg
This has probably already asked a million times before but here goes again.
For the past hours i've been trying to copy the contents of an invisible
IFRAME to a DIV. Browsed the web a lot for examples, turns out in theory
it's pretty easy. This is what i did:
[source]
<script language="javascript">
var timer1 = "";
var done = false;
function StartWorking(){
timer1 = window.setInterval("ImWorking()", 100);
}
function ImWorking(){
if (done == true) {
window.clearInterval(timer1);
timer1 = "";
x = document.getElementById("content");
y = document.getElementById("buffer").document.body;
x.innerHTML = y.innerHTML;
}
}
</script>
<div id="content">Old content</div>
<iframe id="buffer"
src="https://secure.postplaza.nl/NASApp/tracktrace/FindByBarcodeServlet?BARC
ODE=3SPSCL50396456&ZIPCODE=3581HJ style="display:none"></iframe>
<script language="javascript">
StartWorking()
</script>
<script>
done = true
</script>
[/source]
Needless to say it doesn't work. Instead of the contents of the iframe it
shows the content of the parent document. I tried to use
ContentWindow.document.body instead of document.body, and then it doesn't
show anything at all. Anyone knows what i might be doing wrong? Thanks for
the assistance.
Floris
For the past hours i've been trying to copy the contents of an invisible
IFRAME to a DIV. Browsed the web a lot for examples, turns out in theory
it's pretty easy. This is what i did:
[source]
<script language="javascript">
var timer1 = "";
var done = false;
function StartWorking(){
timer1 = window.setInterval("ImWorking()", 100);
}
function ImWorking(){
if (done == true) {
window.clearInterval(timer1);
timer1 = "";
x = document.getElementById("content");
y = document.getElementById("buffer").document.body;
x.innerHTML = y.innerHTML;
}
}
</script>
<div id="content">Old content</div>
<iframe id="buffer"
src="https://secure.postplaza.nl/NASApp/tracktrace/FindByBarcodeServlet?BARC
ODE=3SPSCL50396456&ZIPCODE=3581HJ style="display:none"></iframe>
<script language="javascript">
StartWorking()
</script>
<script>
done = true
</script>
[/source]
Needless to say it doesn't work. Instead of the contents of the iframe it
shows the content of the parent document. I tried to use
ContentWindow.document.body instead of document.body, and then it doesn't
show anything at all. Anyone knows what i might be doing wrong? Thanks for
the assistance.
Floris