首页 > 其他 > 详细

BOM的history对象

时间:2020-01-30 23:30:22      阅读:98      评论:0      收藏:0      [点我收藏+]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>history对象</title>
</head>
<body>
<input type="button" value="front" onclick="f1()">
<a href="history_obj1.html">555</a>
<script>
//history内部有三个方法:forward,back,go 一个属性 length
function f1() {
// history.forward();
history.go(1);//history.go(0)代表当前页面
}


</script>

</body>
</html>
======================================================================
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Title</title>
</head>
<body>
<input type="button" value="back" onclick="f2()">
<script>
function f2() {
// history.back();
history.go(-1);
alert(history.length);// 2 返回历史URL个数

}


</script>

</body>
</html>

BOM的history对象

原文:https://www.cnblogs.com/startl/p/12244267.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!