有好多个页面,想让主页面成为打开固定的页面。
有好多个页面,想让主页面成为打开固定的页面。
你把你想要第一个访问的html文件的名字, 命名为index.html, 就可以了, 求采纳。
用window.location.href
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body>
<a href="./index.html">本页跳转</a>
<a href="./index.html" target="_blank">新开窗口跳转</a>
<button onclick="goToIndex()">点击本页跳转</button>
<script>
function goToIndex() {
window.location.href = "index.html";
}
</script>
</body>
</html>
web.xml修改配置。。默认就是index.html