1 、点击事件οnclick=function(){}
2、确认框 window.confirm()
3、页面跳转 location.href ( ./当前目录下)
<script>
document.getElementById("paymoney").onclick=function(){
let result=window.confirm("您确实要支付吗?");
if(result){
location.href='./01-success.html';
}
}
</script>
4、定时器
<script>
window.onload=function(){
let timer=10;
setInterval(()=>{
timer--;
document.getElementById("jumpTo").innerText=timer;
if(timer==0){
location.href="https://www.baidu.com/";
}
},1000);
}
}
</script>
总代码
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title