SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    PHP warrior dkode's Avatar
    Join Date
    Sep 2001
    Location
    Planet Namek
    Posts
    329
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    javascript problem with window.open

    here is my function:

    <script Language="JavaScript">
    function openWin(fileName, w, h) {

    windowName = 'HalstonsJewelry-Gifts.com';
    windowProps = 'height=' + h + ',width=' + w + ',toolbar=no,status=yes,scrollbars=yes,menubar=no,resizeable=yes';
    win = window.open(fileName, windowName, windowProps);

    if (parseInt(navigator.appVersion) >= 4) {
    win.window.focus();
    }
    }
    </script>

    here is what i'm calling it with:
    <a href='javascript:' onClick='openWin("pop.php",250,300);' class='link_red'>

    the error i consistently get is the following:

    Line 45 error. (that's the line with the win = window.open(fileName,windowName, windowProps);

    Invalid Argument?

    I can't figure it out.
    "Mankind cannot define memory, yet it defines mankind"
    -- Project 2501, Ghost in the Shell

    Smarty | PEAR | PHP Manual | MySQL Manual

  2. #2
    SitePoint Evangelist azizur_rahman's Avatar
    Join Date
    Nov 2001
    Location
    London, UK
    Posts
    502
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    change:
    windowName = 'HalstonsJewelry-Gifts.com';
    to

    Code:
    windowName = 'HalstonsJewelryGiftscom';
    or

    Code:
    windowName = 'LoadingPleaseWait';
    the reason being windowname cant have any of the following characters [] {} ., /?\@# and so on.

    but why dont just call it PopUp
    Code:
    windowName = 'PopUp';
    Azizur Rahman
    Web Application Developer

  3. #3
    PHP warrior dkode's Avatar
    Join Date
    Sep 2001
    Location
    Planet Namek
    Posts
    329
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i don't think thats the problem, i tried compeltely removing the windowName all together and still the same error?:

    <script Language="JavaScript">
    function openWin(fileName, w, h) {
    windowName = 'Halstons Jewelry and Gifts';
    windowProps = 'height=' + h + ',width=' + w + ',toolbar=no,status=yes,scrollbars=yes,menubar=no,resizeable=yes';
    win = window.open(fileName, windowProps);

    if (parseInt(navigator.appVersion) >= 4) {
    win.window.focus();
    }
    }
    </script>
    "Mankind cannot define memory, yet it defines mankind"
    -- Project 2501, Ghost in the Shell

    Smarty | PEAR | PHP Manual | MySQL Manual

  4. #4
    SitePoint Evangelist azizur_rahman's Avatar
    Join Date
    Nov 2001
    Location
    London, UK
    Posts
    502
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    have you tried with just one word as I told you?

    winName is a required therefore, you'll get invalid parameter error....

    because .open() requires this parameter...
    Azizur Rahman
    Web Application Developer


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •