JavaScript-前进后退window.history.go(1)-后退window.history(-1)-设置地址栏上url:window.location.href=' 网址
2022/6/13 1:20:18
本文主要是介绍JavaScript-前进后退window.history.go(1)-后退window.history(-1)-设置地址栏上url:window.location.href=' 网址,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
1、前进:onclick="window.history.go(1)"
2、后退:onclick="window.history.go(-1)"
onclick="window.history.back()"
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>006-history对象.html</title> <!--006--007联合起来看代码 --> </head> <body> <a href="007.html">007页面</a> <input type="button" value="前进" onclick="window.history.go(1)"/> </body> </html>
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>007</title> </head> <body> 007page! <input type="button" value="后退" onclick="window.history.back()"/> <input type="button" value="后退" onclick="window.history.go(-1)"/> </body> </html>
3、设置浏览器地址栏上的url:window.location.href=' 网址'
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>008设置浏览器地址栏上的url</title> <!-- window.location.href="url" <input type="button" value="百度" onclick="goBaidu()"> --> </head> <body> <script type="text/javascript"> function goJD(){ window.location.href='http://www.jd.com' } function goBD(){ window.location.href='http://www.baidu.com' } </script> <input type="button" value="京东" onclick="goJD()" > <input type="button" value="百度" onclick="goBD()" > </body> </html>
这篇关于JavaScript-前进后退window.history.go(1)-后退window.history(-1)-设置地址栏上url:window.location.href=' 网址的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-05-15鸿蒙生态设备数量超8亿台
- 2024-05-13TiDB + ES:转转业财系统亿级数据存储优化实践
- 2024-05-09“2024鸿蒙零基础快速实战-仿抖音App开发(ArkTS版)”实战课程已上线
- 2024-05-09聊聊如何通过arthas-tunnel-server来远程管理所有需要arthas监控的应用
- 2024-05-09log4j2这么配就对了
- 2024-05-09nginx修改Content-Type
- 2024-05-09Redis多数据源,看这篇就够了
- 2024-05-09Google Chrome驱动程序 124.0.6367.62(正式版本)去哪下载?
- 2024-05-09有没有大佬知道这种数据应该怎么抓取呀?
- 2024-05-09这种运行结果里的10.100000001,怎么能最快改成10.1?