[英]How to Redirect parent page after some seconds
我正在制作一個頁面,其中有一個提交按鈕。 當我單擊它時,它將重定向到karloshopping.php
並在新選項卡中打開。
幾秒鍾后如何重定向到父頁面到其他頁面?
<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'])){
}
?>
如果我對您的理解正確,請先嘗試重定向到空白頁,例如action = "empty.php"
,然后在該空白頁上輸入標題
<?php
header("refresh:5; url=parentpage.php");
echo"you will now be redirected to parentpage.php in 5 seconds..";
?>
編輯:
閱讀您的評論后,您也可以嘗試類似的方法。
<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'])){
}
?>
在您的karloshopping.php
執行與上面相同的操作:
<?php
header("refresh:5; url=parentpage.php");
echo"you will now be redirected to parentpage.php in 5 seconds..";
?>
您還可以使用JavaScript功能:
<script type="text/javascript">
function reDirectit()
{
var url = "http://www.stackoverflow.com";
window.location(url);
}
</script>
經過我們的討論,我認為這正是您想要的。
<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表示8秒。 您可以根據自己的要求進行設置。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.