questo è un modo quasi uguale
codice:
var w = null;
function Button1_onclick()
{
w = window.open("b.htm", "popup", "top=300px, left=300px, width=300px, height=300px");
if(w) w.focus();
lancia_metodo_timeout(function() {mia_funzione( new Date() );});
function mia_funzione(a)
{
w.document.getElementById("div1").innerHTML = a + "
" + "Ciao, Mondo!";
}
}
function lancia_metodo_timeout(funzione, n, onload)
{
if(n == undefined) n = 0;
if(n > 10) { alert("troppe iterazioni."); return;}
if(!w.document.getElementById("div1") || n == 0)
{
n++;
window.setTimeout(function(){lancia_metodo_timeout(funzione, n, onload)}, 250);
}
else
{
funzione();
if(onload && typeof(onload) == "function")
{
onload();
}
}
}