Quick Javascript Help

Grimace

macrumors 68040
Original poster
Feb 17, 2003
3,541
35
with Hamburglar.
Hi all, I am pulling my hair out trying to figure out why my basic javascript code for a popup window won't work with Firefox or IE (it works fine with Safari!) A blank page opens in Firefox (view source reveals just the <html><head><body> tags). Page can't be displayed shows up in IE.
---------------------------------------------------------------
In the <head> section:

<script language="javascript">

function test(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=550,height=500');");
}
</script>
--------------------------------------------------------------

In the <body> section:

<a href="javascript:test('http://www.google.com')">Google</a>
 

Palad1

macrumors 6502a
Feb 24, 2004
647
0
London, UK
stop evaluating ;)

Code:
<script>
function test(URL)
{
  var id=new Date().getTime();
  var w=window.open(URL,id,'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=550,height=500');
}

</script>
<a href="javascript:test('http://www.google.com')">url</a>
Javascript is not strictly-typed, use this to your advantage ;)