Click to See Complete Forum and Search --> : Popup Window script explanations needed.


Wallykid
07-24-2003, 02:24 PM
function popUp(URL) {
day = new Date();
id = day.getTime();
alert(id);
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=200');");
}

This is a popup window script. However, i do not understand why we are using the eval() method i guess thats what it is. And why are we using "page" + id+" ....what does that do?

Can someone please let me know? Thanks.

Khalid Ali
07-24-2003, 03:10 PM
eval is used to convert a string+any variables to a an object eference in the case above.

see the documentationon it here

http://devedge.netscape.com/library/manuals/2000/javascript/1.5/guide/fcns.html#1008364

page+id creates an object with word page and the time stamp with it for future use

Wallykid
07-29-2003, 11:35 AM
Read through the explanation in the link, seems like it is creating a unique id for the page, but still, i don't know why we have to do that. I have tried using just


eval( "window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,men
ubar=0,resizable=0,width=500,height=200');");

shouldn't that work?

Thanks for the reply