1
我想制作一个Web应用程序,其中有多个页面我希望当我点击任何链接时,它应该移动到该页面我从网站上获得的代码工作正常但我想,它不使用ancchor标签如何在单个html文件中添加多个页面
<html>
<head>
<script>
function show(shown, hidden) {
document.getElementById(shown).style.display='block';
document.getElementById(hidden).style.display='none';
return false;
}
</script>
</head>
<body>
<div id="Page1">
Content of page 1
<a href="#" onclick="return show('Page2','Page1');">Show page 2</a>
</div>
<div id="Page2" style="display:none">
Content of page 2
<a href="#" onclick="return show('Page1','Page2');">Show page 1</a>
</div>
</body>
</html>
我可能是错的(因为我避免了html5和其他奇特的新网络技术,因为我年纪大了,脾气暴躁),但是你声明你的javascript是正确的(可以说