支付成功后跳转

复制代码
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <title></title>
        <style type="text/css">
            *{
                margin: 0;
                padding: 0;
            }
            #box{
                margin: 100px auto;
                width: 250px;
                height: 200px;
                background-color: darkgray;
                text-align: center;
                line-height: 40px;
            }
        </style>
        <script type="text/javascript">
            /*
                需求
                    点击确认出现弹框,如果点击确定会支付,并且10秒后返回到购买页面
                    点返回则立即返回到购买页面
            */
           window.onload = function(){
             //获取两个按钮
               var buy = document.getElementById("btn01");
               var nobuy = document.getElementById("btn02");
               buy.onclick = function(){
                   var yes = confirm("买吗");
                   if(yes){
                       // window.open("成功后界面.html","_self");
                       window.location.href = "成功后界面.html";
                   }else{
                       alert("您取消了支付~~");
                   }
               }
               nobuy.onclick = function(){
                   alert("不买就不要点我~~");
               }
           };
        </script>
    </head>
    <body>
        <div id="box">
            <p>商品:Wbe前端课程</p>
            <p>原件:1980</p>
            <p>现价:1.98</p>
            <p>内容:HTML、CSS、JS</p>
            <p>地址:中国</p>
            <button id="btn01">购买</button>
            <button id="btn02">不买,太贵了</button>
        </div>
    </body>
</html>
复制代码

 

posted @   st-159  阅读(122)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
点击右上角即可分享
微信分享提示