<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<button id="taobao">阿里巴巴</button><br>
<button id="hou">后退</button>
<button id="qian">前进</button>
</body>
<script>
var t = document.getElementById("taobao");
var q = document.getElementById("qian");
var h = document.getElementById("hou");
t.onclick = function(){
window.location.href = "https://p4psearch.1688.com/";
}
q.onclick = function(){
window.history.forward();
}
h.onclick = function(){
window.history.back();
}
</script>
</html>
location对象,history对象的使用
最新推荐文章于 2024-07-23 11:32:13 发布