<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> </head> <body> <input type="button" id="btn" value="跳转"> <script> var btn = document.getElementById('btn'); btn.onclick = function () { // console.log(location.href); // location.href = 'http://www.itheima.com'; // assign 委派 // assign() 的作用和href的作用一样。可以让页面跳转到指定的地方 // location.assign('http://www.itheima.com'); // // 替换掉地址栏中的地址,但是不记录历史 // location.replace('http://www.itheima.com'); // 重新加载 refresh f5 // // 参数 true 强制从服务器获取页面 false 如果浏览器有缓存的话,直接从缓存获取页面 location.reload(true); // f5 刷新页面,可能从缓存中加载 control+f5 强制刷新 从服务器获取页面 } </script> </body> </html>
bom-location
猜你喜欢
转载自www.cnblogs.com/jiumen/p/11419525.html
今日推荐
周排行