总结九月二十六

 History对象

作用:back()返回下一个页面

           froward()进入下一个页面

           go(1)请进一个页面

           go(-1)返回上一个页面

 使用方法演示:

第一个页面中写跳转到第二个 就是href

<input type="button" name="" id="btn" value="打开02.html" />
		<script type="text/javascript">
			btn.onclick=function(){
				location.href="02.html"
			}
		</script>

 第二个页面写返回,跳转,上一个页面,go:back、href、forward、go

<body>
		
		<input type="button" name="" id="btn1" value="back" />
		<input type="button" name="" id="btn2" value="打开03.html" />
		<input type="button" name="" id="btn3" value="forward" />
		<input type="button" name="" id="btn4" value="go" />
		
		<script type="text/javascript">
			btn1.onclick=function(){
				history.back()
			}
			btn2.onclick=function(){
				location.href="03.html"
			}
			btn3.onclick=function(){
				history.forward()
			}
			btn4.onclick=function(){
				history.go(-1)
			}
		</script>
		
	</body>

 第三个页面写跳转上一个

<body>
		
		<input type="button" name="" id="btn5" value="返回02.html" />
		<input type="button" name="" id="btn6" value="go" />
		
		<script type="text/javascript">
			btn5.onclick=function(){
				history.back()
			}
			btn6.onclick=function(){
				history.go(-1)
			}
		</script>
		
	</body>

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值