window.location.href
来实现页面跳转。,``javascript,document.getElementById("myButton").onclick = function() {, window.location.href = "https://www.example.com";,};,
``window.location.href
来实现页面跳转。,``javascript,document.getElementById("myButton").onclick = function() {, window.location.href = "https://www.example.com";,};,
``window.location
或 window.location.href
来跳转页面。使用以下代码可以跳转到一个新的 URL:,,``javascript,window.location.href = "https://www.example.com";,
`,,还可以使用
window.location.assign() 方法:,,
`javascript,window.location.assign("https://www.example.com");,
``,,这两种方法都可以用来实现页面跳转。Powered By Z-BlogPHP 1.7.3