<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>history1</title> </head> <body> <input type="button" value="前进" οnclick="func1()"> <a href="history2.html">history2</a> </body> <script> function func1(){ //history.forward(); //前进到上一个页面 history.go(2); //往前前进几个页面 } </script> </html>
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>history2</title> </head> <body> <input type="button" value="后退" οnclick="func2()"> </body> <script> function func2(){ //history.back(); //后退到后一个页面 history.go(-1) } </script> </html>
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>location</title> </head> <body> <input type="button" value="重载" οnclick="location.reload()"> <input type="button" value="重载" οnclick="location.href='http://www.baidu.com'"> </body> </html>