窗口历史记录(-1)不起作用

2022-01-16 00:00:00 asp-classic javascript html

我使用下面的代码返回上一页,但它不起作用.即使我在页面上单击确定",警报框仍会弹出.实际上有 3 页包含此 Windows 页面代码.第一页是用户需要填写的表格名称redeem_newcust.asp,操作应该是将所有数据保存到名为redeem_newcustDB.asp的数据库中.在redeem_newcustDB.asp 页面中有一个代码可以选择兑换类型的选项,然后此页面将指向redeem_newprocess.asp 页面的操作,其中包含如下代码.表示当用户点击不等于生日礼包 - PDV RM50"的兑换类型时,它应该返回到上一页,即页面redeem_newcustDB.asp.有可能回到上一页..?b 是否需要带来所有的价值?请帮忙,谢谢

I have use below code to back for the previous page, but it's not working. the alert box still popup even i click ok on the page. actually there have 3 page include this windows page code. 1st page is user need to fill up the form is name redeem_newcust.asp and the action should be save all the data into the database named redeem_newcustDB.asp. In page redeem_newcustDB.asp have one code to select option for type of redemption then this page will point action to the page redeem_newprocess.asp with is included as below code. Means when user click on type of redemption not equal to "Birthday Pack - PDV RM50" then it should be back to the previous page that means page redeem_newcustDB.asp. It's possible to having back to that previous page..? Should b need to bring all the value? Please help, thanks

If redeemtype = "Birthday Pack - PDV RM50" then
        Response.Redirect("redeem_newbirth.asp?cardno="&BlinkCard&"&redeemtype="&redeemtype&"")
    Else
        %>
            <script language="javascript">
            <!--
            window.alert ("Please choose Type of Redemption");
            window.history.go(-1);
            //-->
            </script>
        <%   
End If

%>

推荐答案

使用:window.history.back() 代替 .go();

http://www.w3schools.com/jsref/met_his_back.asp

或使用:

window.alert("Please choose Type of Redemption");
setTimeout(function(){
  window.history.go(-1);
},500);

相关文章