简体   繁体   English

Javascript / PHP弹出页面问题

[英]Javascript/PHP popup page problem

I have a program in PHP that allows user to pop in a message, for confirmation from user. 我有一个PHP程序,允许用户弹出一条消息,以供用户确认。 As seen below is the link i used. 如下所示是我使用的链接。

From inbox.php : inbox.php

echo "<a href='inbox.php' onclick=\"popup('acknowledge.php?id=$id')\"><font size=1px color=maroon>acknowledge</font></a></td>";

From acknowledge.php : accept.php

if ($_POST['no']) {

    header("location: inbox.php");
    }

?>

<body bgcolor=skyblue>
<center><form name=form1 method=post>
<b><u> Acknowledge Message </u></b><br><br>
Are you sure yout want to acknowledge this message?<br><br>
<input type=button name=yes value="Yes">
&nbsp;
<input type=submit name="no" value="No">
</form>
</center>
</body>

The problem is, everytime i click "no", to go back from previous page. 问题是,每次我单击“否”都从上一页返回。 It sets the page size the same as the popup page. 它将页面大小设置为与弹出页面相同。 It becomes smaller too. 它也会变小。 What's the problem? 有什么问题? Answers are very much appreciated. 非常感谢您的回答。

Here is the code for popup(): 这是popup()的代码:

<script language="JavaScript" type="text/JavaScript">

<!-- function popup(url) {
     var width  = 500;
     var height = 135;
     var left   = (screen.width  - width)/2;
     var top    = (screen.height - height)/2;
     var params = 'width='+width+', height='+height;
     params += ', top='+top+', left='+left;
     params += ', directories=no';
     params += ', location=no';
     params += ', menubar=no';
     params += ', resizable=no';
     params += ', scrollbars=no';
     params += ', status=no';
     params += ', toolbar=no';
     newwin=window.open(url,'windowname5', params);
     if (window.focus) {newwin.focus()}
               return false;
    }
                // -->

</script>

是否不是因为您将URL设置为新窗口而不是当前窗口?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM