js5——页面转换

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>

</head>
<body>
<input type="button" id="btn" value="刷新">
<input type="button" id="goItcast" value="去传智">
<script>
//reload方法,定义一个按钮 刷新当前的页面
// var h1=window.history;
// var h2=history;
// alert(h1);
// alert(h2);
// setInterval(fun,3000);
// function fun() {
// alert("name")
// }
var btn=document.getElementById(btn);
btn.onclick=function () {
location.reload();

}

// alert(href);
//点击按钮去访问www.itcast.cn官网
var goItcast=document.getElementById("goItcast");
goItcast.onclick=function () {
location.href="https://www.baidu.com";
}
var href=location.href;
</script>
</body>
</html>

猜你喜欢

转载自www.cnblogs.com/soyadios/p/11963455.html
js5
今日推荐