agtlewis wrote:I'm not versed in javascript, and I found a snippet I modified a little bit for my needs. I noticed that it's using an eval statement, and a Date function. I am wondering why.
Code: Select all
function OpenWindow(pagename, pageheight, pagewidth) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=" + pagewidth + ",height=" + pageheight + "');");
}
If i understand well, they want to be able to reference to the window with pageX (where X is the id)...
I don't see a reason to use the time as X though...
If no reference to the window is needed, simply call windows.open and don't assign to a variable...
If a reference is needed, use an array instead

pages[id] = window.open...
(PS: I just started JS so i'm not an expert and take it with a grain of salt

)