/*
Location 对象属性
*/
// 创建 a 标签并设置 href 属性
var url = document.createElement("a");
url.href = "https://www.runoob.com/?s=python#test";
console.log(url.href); // https://www.runoob.com/?s=python#test
console.log(url.protocol); // https:
console.log(url.host); // www.runoob.com
console.log(url.hostname); // www.runoob.com
console.log(url.port); // (输出为空 - https 默认端口为 443)
console.log(url.pathname); // /
console.log(url.search); // ?s=python
console.log(url.hash); // #test
console.log(url.origin); // https://www.runoob.com
console.log("-----------------------------------------------")
var url = document.createElement("a");
url.href = "http://cashier.pays.com/000000EB9q?daily";
console.log(url.href); // http://cashier.pays.com/000000EB9q?daily
console.log(url.protocol); // http:
console.log(url.host); // cashier.pays.com
console.log(url.hostname); // cashier.pays.com
console.log(url.port); // (输出为空 - https 默认端口为 443)
console.log(url.pathname); // /000000EB9q
console.log(url.search); // ?daily
console.log(url.hash); //
console.log(url.origin); // http://cashier.pays.com