简体   繁体   English

几秒钟后如何重定向父页面

[英]How to Redirect parent page after some seconds

I am making a page in which there is a submit button. 我正在制作一个页面,其中有一个提交按钮。 When I click it, it redirects to karloshopping.php and opens in a new tab. 当我单击它时,它将重定向到karloshopping.php并在新选项卡中打开。

How to redirect to the parent page after some seconds to some other page? 几秒钟后如何重定向到父页面到其他页面?

    <form class="lele" id="lele" name="lele" method="post" action='karloshopping.php?param=<?php echo $_SESSION['user_id'] ?>' target=_blank>
        <input type="submit" value="I Understand,Visit the Retailer" id="lelebtn" class="buttom" name="lelebtn" /><br/>
    </form>
</div>
<?php
if(isset($_POST['lelebtn'])){

}
?>

If I've understood you correctly, try redirecting to an empty page at first, something like action = "empty.php" and then on that empty page give the header like 如果我对您的理解正确,请先尝试重定向到空白页,例如action = "empty.php" ,然后在该空白页上输入标题

<?php
header("refresh:5; url=parentpage.php");
echo"you will now be redirected to parentpage.php in 5 seconds..";
?>

EDIT: 编辑:

After reading your comment, you could try something like this too; 阅读您的评论后,您也可以尝试类似的方法。

 <form class="lele" id="lele" name="lele" method="post" action='karloshopping.php?param=<?php echo $_SESSION['user_id'] ?>' target=_blank>
        <input type="submit" value="I Understand,Visit the Retailer" id="lelebtn" class="buttom" name="lelebtn" /><br/>
            </form>
        </div><?php
        if(isset($_POST['lelebtn'])){



        }
        ?>

In your karloshopping.php do something like I did above: 在您的karloshopping.php执行与上面相同的操作:

<?php
    header("refresh:5; url=parentpage.php");
    echo"you will now be redirected to parentpage.php in 5 seconds..";
    ?>

You could also use a JavaScript fucntion: 您还可以使用JavaScript功能:

<script type="text/javascript">
    function reDirectit()
    {
    var url = "http://www.stackoverflow.com";
    window.location(url);
    }
    </script>

After our discussion, I think this is exactly what you are looking for; 经过我们的讨论,我认为这正是您想要的。

<script type="text/javascript">
function redirect()
{
window.location.href="pagez.php";

}
</script>
<form method = "post" action = "pagey.php" target = "_blank">
<input type="submit" value="Go" onClick = "return redirect();" />
</form>
setTimeout(function(){
    window.location.href = "pagez.php";
}, 8000);

8000 means 8 seconds. 8000表示8秒。 You can set as per your requirements. 您可以根据自己的要求进行设置。

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

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