PDA

View Full Version : close and open dhtml window using same variable name



swingtrader
04-09-2008, 08:54 AM
1) Script Title: DHTML Window widget (v1.1)

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex8/dhtmlwindow/

3) Describe problem: hi, i need to reopen the dhtml window that i closed before using same variable name (because i'm gonna use this variable name further), here is my code

function opennewwindow(targetname)
{
if (!infowindow[targetname])
{
infowindow[targetname]=dhtmlwindow.open("infowindow"+targetname,"iframe","infowindow.php?target="+targetname,targetname,"width=590px,height=350px,resize=1,scrolling=1,center=1","recal");
infowindow[targetname].onclose=function()
{
setInterval("deleteinfowindow('"+targetname+"')",100);
}
}
}
function deleteinfowindow(targetname)
{
delete infowindow[targetname];
}

but when i close the dhtml window
and then reopened it (say i'm using a link to run the function opennewwindow('abcd'))
then the variablename should be infowindow['abcd'] right?
but i cannot access that variable, that variable doesn't exist like the first time i open that dhtml window using that name

anyone can help?
thx

swingtrader
04-09-2008, 10:32 AM
ok sorry, my bad, i made a silly mistake
i shouldn't have used setInterval :p
i should have used setTimeout..
btw thx anyway