<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<script language="JavaScript">
function loading(){
var output = document.getElementById("output");
output.value= history.length;
}
/**
* back 向前一个历史页面
* forward 向后一个历史页面
* go(参数值) 根据参数值跳转至指定历史页面
* @param mothod
*/
function historyTest(mothod) {
if(mothod=='back'){
history.back();
return;
}
if(mothod=='forward'){
history.forward();
return;
}
if(mothod=='go'){
history.go();
return;
}
}
</script>
</head>
<body οnlοad="loading()">
<input type="text" id="output" />
<input type="button" value="back" οnclick="historyTest('back')"/>
<input type="button" value="forward" οnclick="historyTest('forward')"/>
<input type="button" value="go" οnclick="historyTest('go')"/>
</body>
</html>