本周学习了用js实现支付页面的跳转功能,逻辑为:
1.在支付界面时,点击确定支付,弹出确认框,确认后跳转到支付成功页面。
2.在支付成功界面时,会在倒计时10秒后自动跳转页面,或者点击立即返回立即跳转页面。
代码如下:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>js支付</title>
</head>
<body>
<div>
<p>商品:</p>
<p>价格:0.01元</p>
<p>内容:html,css.js</p>
<p><button id="sure">确定支付</button>
<button>取消</button>
</p>
</div>
<script>
document.getElementById('sure').onclick=function(){
var res=window.confirm('您确定要支付吗');
if(res){
location.href='./js支付成功.html';
}
}
</script>
</body>
</html>
<!doctype html>
<html>
<head>
<meta charset="