www.webdeveloper.com
Results 1 to 2 of 2

Thread: Pop-up Code

  1. #1
    Join Date
    Oct 2005
    Posts
    102

    Pop-up Code

    Here is a little combination of PHP and Javascript. The PHP is all correct, but I don't think the javascript is. What it is suppose to do is check to see if the condition is met (Which it is), and then have a pop-up occur. However, the pop-up never opens, and my pop-up blocker is off.

    Code:
    <?php
    $query = "SELECT * FROM `ChatSession` WHERE `to` = '$name' AND `toboard` = '$board' AND `new` = '1'";
    $sql = mysql_query($query);
    while($row = mysql_fetch_array($sql))
    {
    $new = $row['new'];
    $cid = $row['ChatID'];
    }
    echo "<SCRIPT LANGUAGE=\"JavaScript\">
    <!-- Begin
    function popUp(URL) {
    day = new Date();
    id = day.getTime();
    eval(\"page\" + id + \" = window.open(URL, '\" + id + \"', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=600,height=300,left = 540,top = 300');\");
    }
    // End -->
    </script>";
    
    if($new == 1)
    {
    echo "<BODY onLoad=\"javascript:popUpNM('chat/chat.php?id=$cid&rid=$rid')\">";
    $q = "UPDATE `ChatSession` SET `new` = '0' WHERE `ChatID` = '$cid'";
    mysql_query($q);
    }
    echo "</body>";
    Thanks for the help.
    Last edited by Hendrick2; 07-23-2007 at 02:00 AM.

  2. #2
    Join Date
    Apr 2007
    Posts
    71
    Try to put
    Code:
    echo "<SCRIPT LANGUAGE=\"JavaScript\">
    <!-- Begin
    function popUp(URL) {
    day = new Date();
    id = day.getTime();
    eval(\"page\" + id + \" = window.open(URL, '\" + id + \"', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=600,height=300,left = 540,top = 300');\");
    }
    all in one line.
    Also in
    Code:
    'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=600,height=300,left = 540,top = 300'
    erase all white spaces.
    If it's still don't work that it's maybe problem with escaping "

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles