duanbarong4617 2013-10-20 20:31
浏览 32
已采纳

链接上的Javascript window.open在PHP中不起作用

I have the following script located at the top of my web page to open a popup window based on the URL parameter I pass it...

<Script Language="JavaScript">
function showDetails(source) {
    window.open(source,"","scrollbars=no,menubar=no,height=600,width=800,resizable=yes,toolbar=no,location=no,status=no");
}
</Script>

And I have the following PHP code that calls the function to open the window and passes the url...

$QueryResult = @$this->DBConnect->query($SQLString);

            if ($QueryResult !== FALSE) {
                if ($QueryResult->num_rows > 0) {       
                    while (($Row = $QueryResult->fetch_assoc())
                                    !== NULL) {
                        echo "<br /><a href='javascript:showDetails(http://server/~user/PHP/EventDetails.php?PHPSESSID=".session_id()."&EventID=".$Row['EventID'].")'>".
                                htmlentities($Row['Title'])."</a>";
                    }
                }
                echo "</td>";

                if ((($FirstDOW + $i) % 7) == 0) {
                    echo "</tr>";
                }
            }

When I hover over the link on the web page the URL passed to the function looks fine, and I see something like this at the bottom of the browser, however, when I click the link it does nothing...

javascript:showDetails(http://server/~user/PHP/EventDetails.php?PHPSESSID=Hij3234Abdc732hlae&EventID=2)
  • 写回答

2条回答 默认 最新

  • drt12345678 2013-10-20 20:34
    关注

    Syntax error.

    echo "<br /><a href='javascript:showDetails(\"http://server/~user/PHP/EventDetails.php?PHPSESSID=".session_id()."&EventID=".$Row['EventID']."\")'>".htmlentities($Row['Title'])."</a>";
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog
  • ¥15 Excel发现不可读取的内容
  • ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题
  • ¥20 yolov5自定义Prune报错,如何解决?