T
Templar
Hi i'm bothering with such problem... I must dynamic create an Iframe, and
then put som raw HTML into it. But I can't.
When I create iframe, I can't access its properties.
Here's the coe snipplet:
//*************************************
//*************************************
function doTheIframe(nazwa, width, height) {
ifrm = document.createElement("iframe");
ifrm.setAttribute("name", nazwa);
ifrm.setAttribute("id", nazwa);
ifrm.setAttribute("src", "");
ifrm.style.width.value = width+"px";
ifrm.style.height.value = height+"px";
document.body.appendChild(ifrm);
}
function main() {
doTheIframe('smallframe',100,100);
document.getElementById('smallframe').contentWindow.document.body.innerHTML=
"TEST";
}
<a onclick="main()">Tratatata</a>
//*************************************
//*************************************
When I click the link, iframe is created but not pupulated.
When I click for the second time, second frame is created and the first one
is populated.
I want to populate the iframe immediately.
How to do this?
Regards,
Templar
then put som raw HTML into it. But I can't.
When I create iframe, I can't access its properties.
Here's the coe snipplet:
//*************************************
//*************************************
function doTheIframe(nazwa, width, height) {
ifrm = document.createElement("iframe");
ifrm.setAttribute("name", nazwa);
ifrm.setAttribute("id", nazwa);
ifrm.setAttribute("src", "");
ifrm.style.width.value = width+"px";
ifrm.style.height.value = height+"px";
document.body.appendChild(ifrm);
}
function main() {
doTheIframe('smallframe',100,100);
document.getElementById('smallframe').contentWindow.document.body.innerHTML=
"TEST";
}
<a onclick="main()">Tratatata</a>
//*************************************
//*************************************
When I click the link, iframe is created but not pupulated.
When I click for the second time, second frame is created and the first one
is populated.
I want to populate the iframe immediately.
How to do this?
Regards,
Templar