var a=location.href; console.log(a); // “http://www.cnblogs.com/wuxibolgs329/p/5261577.html#flag?test=12345”
var host = window.location.host; //www.cnblogs.com var host2 = document.domain; //www.cnblogs.com var a = location.hostname; //www.cnblogs.com
var a=location.protocol; console.log(a); //http:
var a=location.port; console.log(a);
var a=location.pathname; console.log(a);
var a=window.location.hash; var b=a.substr(1); console.log(b); // flag?test=12345
// 此时案例地址变为“http://www.cnblogs.com/wuxibolgs329/p/5261577.html?test=12345”。得到 test=12345
var a=location.search;
var b=a.substr(1);
console.log(b);
//如果案例依旧是“http://www.cnblogs.com/wuxibolgs329/p/5261577.html#flag?test=12345”,则需下面的写法,得到 test=12345
var a=location.href;
var b=a.substr(a.lastIndexOf('?')+1);
console.log(b);
var a=location.href;
var b=a.substring(a.lastIndexOf('=')+1);
console.log(b); // 12345
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2026 源码网商城 (www.ymwmall.com) 版权所有