locatin

时间:2021-06-20 06:47:29
 //location对象
//初始url:http://www.wrox.com/WileyCDA;
//将URL修改为:http://www.wrox.com/WileyCDA/#section1
location.hash="#section1"
//将URL修改为:http://www.wrox.com/WileyCDA/?q=javascript
location.search="?q=javascript"
//将URL修改为:http://www.yahoo.com/WileyCDA/
location.hostname="www.yahoo.com"
//将URL修改为:http://www.yahoo.com/mydir
location.pathname="mydir"
location.post=8080;
location.assign("http://www.wrox.com");
// 等同于:
//window.location="http://www.wrox.com"
// location.href="http://www.wrox.com"
location.replace("http://www.wrox.com")//不会产生历史记录

相关文章