JavaScript基础:变量、字符串、数组与表达式操作
1. 网页中的历史导航按钮
在网页开发中,我们可以使用 JavaScript 来实现类似浏览器工具栏中后退和前进箭头按钮的功能。以下是一个完整的 HTML 文档示例:
<html>
<head><title>Back and Forward Buttons</title>
</head>
<body>
<h1>Back and Forward Buttons</h1>
<p>This page allows you to go back or forward to pages in the history list.
These should be equivalent to the back and forward arrow buttons in the
browser’s toolbar.</p>
<p>
<input type=”button”
onClick=”history.back();” value=”<-- Back”>
<input type=”button”
onClick=”history.forward();” value=”Forward -->”>
</p>
</body>
</html>
将这个文档加载到浏览器中后,你可以访问其他 URL,并确保后退和前进按钮能够正常工作。
超级会员免费看
订阅专栏 解锁全文
3460

被折叠的 条评论
为什么被折叠?



