<script type="text/javascript">
var r = confirm("Press a button");
if (r == true) {
<?php header('location:index.php');?>
}</script>
//它重定向的index.php中正确执行没有任何代码包含简单的导航代码..的JavaScript cofirm在PHP文件,而不象对话框,下面的代码无法正常工作
<script type="text/javascript">
var r = confirm("Press a button");
if (r == true) {
x = "You pressed OK!";
}</script>
我的问题是这个问题 –
不是真的不同,你要使用服务器端功能与客户端脚本。 – Qirel
而不是'<?php header('location:index.php');?>'您可以使用JavaScript重定向,'window.location =“/index.php”;' – Qirel