在javascript弹出窗口中显示php页面

时间:2015-07-02 11:10:41

标签: javascript php popup

我尝试在弹出的javascript中显示一个php页面,是否有弹出窗口打开页面的可能性?

我有打开新页面的解决方案,但我想在弹出窗口中显示页面内容......

<script>
function popupCenter(pageURL, title, w, h) {
    var left = (screen.width / 2)  - (w / 2);
    var top  = (screen.height / 2) - (h / 2);
    var targetWin = window.open(pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);
}
</script>
<a href="#" onclick="popupCenter('test.php')">show</a>

另外,尝试使用litebox,但没有成功......

TNX, P

1 个答案:

答案 0 :(得分:-1)

<script language="javascript" type="text/javascript">
<!--
function popitup(url) {
    newwindow=window.open(url,'name','height=200,width=150');
    if (window.focus) {newwindow.focus()}
    return false;
}

// -->
</script>

将您的页面放在此处

<a href="popup.php" onclick="return popitup('popup.php')"
    >Link to popup</a>

不要忘记给你的页面名称2个位置。在href和函数内部。