View Full Version : Pop-up window doesnt work in IE8

12-14-2009, 08:51 PM
I use a basic pop-up window code that i have used for many years. I probably need to update it, but i was wondering why it will work for every browser but IE8. Can anyone help?

function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=1,menubar=0,resizable=0,width=600,height=400,left = 540,top = 325');");

<a href="javascript:popUp('/email/agent/aid/<?php echo $this->agent->pers_code?>')" >

can anyone see something that may cause the problem?

Thanks for any help!

12-14-2009, 09:00 PM
dunno if adding a semi-colon to this
<?php echo $this->agent->pers_code?> will make it work but u may want to try it
<?php echo $this->agent->pers_code; ?>

Philip M
12-15-2009, 09:30 AM
id = day.getTime();

In Internet Explorer, names and IDs are global variables and thus you should NEVER use a global variable or function name which is the same as an HTML element name or ID. You should also avoid giving names or id's to your variables/functions/arguments/forms words which are JavaScript methods/properties/attributes such as 'name' or 'id' or 'value' or 'text' or 'checked' or 'submit' or 'replace' or 'button' or 'radio' or 'parseInt'.

I am surprised that id = day.getTime(); ever worked in any IE version. var id = day.getTime(); perhaps, where id is local.

All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.