网址查询字符串用中文,跳转,如果使用中文域名,查询字符串也用中文,这样就方便了,直接在地址栏输入中文就可以跳转到网址,百度,例如http://李四.公司/?百度。如果很多条转发记录,也可以把网址存入数据库,用php读取网址,再跳转到网址。
function pstr(){
//获取网址的查询字符串。
var query = window.location.search.substring(1);
//解码中文字符串。
query=decodeURI(query);
//网址有问号。
var qpos = window.location.href.indexOf("?");
if(qpos>0){
//网址跳转到百度
alert(query);
if(query==“百度”){
window.location.href=“http://www.baidu.com”;
}
}
}
pstr();
网址字符串用中文,跳转,javascript
最新推荐文章于 2023-04-03 10:53:02 发布