更改URL

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>更改URL</title>

</head>
<body>
<input type="button" value="载入新文档" onclick="newPage()">
<input type="button" value="刷新页面" onclick="freshPage()">
<p id="time"></p>
<script>
// 获取并显示当前页面载入的时间
var ds = new Date(), d = ds.getDate();
var t = ds.toLocaleTimeString();
document.getElementById('time').innerHTML = t;
// 载入新文档
function newPage() {
window.location.assign('http://www.example.com')
}
// 刷新文档
function freshPage() {
location.reload(true);
}
</script>
</body>
</html>

posted @ 2020-04-25 09:37  妹妹早上好  阅读(207)  评论(0编辑  收藏  举报