研究了一夜 没办法了
判断当前URL没有指定字符串
比如判断 http://baidu.com/1.php?xx=xx 最后有没有#1234
如果没有自动添加 并刷新进入新连接
到目的 http://baidu.com/1.php?xx=xx#1234
请参考这个网站上的淘宝代码 研究了一夜 搞不明白 。
http://mbk.lyjhc.com/
[code="js"]
var url = window.location;
if(!/#1234$/.test(url)){
window.location = url + '#1234';
}
[/code]
function isExist(destStr,URL){
If(URL.indexOf(destStr)===-1){
URL= url+desrStr
window.location = URL
}
}
var url = window.location.toString();
if(url.lastIndexOf('#1234')==-1){ //!/#1234$/.test(url)
window.location = url + '#1234';
}
如此简单的问题还要思考一夜!
呵呵 有时候脑袋卡住了是这样
:oops: 不会吧哥们 你想了一夜?