ITeye博客

history对象back()、forward()、go()方法

deng131 · 2010-12-11 11:22 · javascript · Web前端 · Markdown

history.back() 功能:加载历史列表中的前一个URL(后退)。

语法:history.back()

调用该方法的效果等价于点击后退按钮或调用history.go(-1)。

history.forward() 功能:加载历史列表中的下一个URL(前进)。

语法:history.forward()

调用该方法的效果等价于点击前进按钮或调用history.go(1)。

history.go() 功能:加载历史列表中的某个具体的页面。

语法:history.go(number)

参数: number:要访问的URL在History的URL列表中的相对位置.

-1代表前一个(forward),0代表当前,1代表(back)后一个。 1(向后) <----- 0(当前) -----> -1(向前) history.go(-1) == history.forward() history.go(1) == history.back() history.current, history.next

评论(3)

  1. #3 楼 · deng131 · 2012-05-22 13:38
  2. #2 楼 · 我是米谷 · 2012-05-10 17:01

    说的太潦草了,很表面的一些知识

  3. #1 楼 · vera_sq · 2011-11-27 21:09

    红色字体部分是不是总结有误呢?-1表示的后退,1表示的是前进??? :)

评论功能维护中,当前仅展示历史评论。