Quick Javascript Help

Discussion in 'Design and Graphics' started by Grimace, Aug 22, 2006.

  1. macrumors 68040


    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');");

    In the <body> section:

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


    stop evaluating ;)

    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');
    <a href="javascript:test('http://www.google.com')">url</a>
    Javascript is not strictly-typed, use this to your advantage ;)
  3. macrumors 68040


    hmm....I still get nothing. :( Shouldn't the </script> show up in a similar font (I'm using DW) like the first one?
  4. macrumors 6502a


    There was a typo, add a single quote before toolbar and you're set to go :)

Share This Page