<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title></title> </head> <body> <h1>第一个页面</h1> <a href="historyPage2.html">下一个页面</a> <input type="button" value="前进" οnclick="next()"> <input type="button" value="最后一个页面" οnclick="goPage()"> </body> <script> alert(history.length); function next(){ history.forward(); } function goPage(){ history.go(3); } </script> </html> <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title></title> </head> <body> <h1>第二个页面</h1> <a href="historyPage3.html">下一个页面</a> <input type="button" value="前进" οnclick="next()"> <input type="button" value="后退" οnclick="back()"> </body> <script> alert(history.length); function next(){ history.forward(); } function back(){ history.back(); } </script> </html> <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title></title> </head> <body> <h1>第三个页面</h1> <a href="historyPage4.html">下一个页面</a> <input type="button" value="前进" οnclick="next()"> <input type="button" value="后退" οnclick="back()"> <input type="button" value="返回到首页" οnclick="goPage()"> </body> <script> alert(history.length); function next(){ history.forward(); } function back(){ history.back(); } function goPage(){ history.go(-2); } </script> </html> <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title></title> </head> <body> <h1>第四个页面</h1> <input type="button" value="后退" οnclick="back()"> </body> <script> alert(history.length); function back(){ history.back(); } </script> </html>
HTML5历史页面之间的互相跳转
最新推荐文章于 2023-06-26 16:46:04 发布