HTML代码window.location.hash差异写的网址和标签
<div class="fakeSearch">
<input id="searchInput" type="text" placeholder="Search">
<img id="searchImg" class="clickAble" src="./img/search.png">
</div>
脚本
window.addEventListener("hashchange", ChangePage);
$('#searchImg').on('click', function(){
var word = decodeURIComponent($('#searchInput').val());
window.location.hash = '#search:'+word;
});
var ChangePage = function(){
var myUrl = window.location.hash;
var argStr = myUrl.split("\\");
argStr = argStr[0].split(":");
argStr[0] = argStr[0].replace("#", "");
$('#mainPlace > div').css('display','none');
if(myUrl === ""){}
...
else if(argStr[0]==='search'){
$('#searchPage').css('display','block');
InitLoadSearch(decodeURIComponent(argStr[1]));
}
}
var InitLoadSearch = function(){
/* call ajax data and print masonry */
}
工作的时候直接写打字网址#搜寻:123
但是,窗口。 location.hash ='#search:'+字代码不起作用。
更正确,默认页面是石匠页面。
*石工 - 我使用http://masonry.desandro.com/
也搜索页面是石工页面。默认页
电网是休息。(位置复位),当搜索点击后退按钮单击仅Android手机铬
每个格子是其他定义
休息。
另外,
<a href="#search:code"></a>
是正常的工作!只有
window.location.hash = "#search:"+variable;
是中断。
总之,我知道区别写网址,HREF标签和window.location.hash
标签是https://www.w3.org/TR/html4/struct/links.html#adef-href我想知道window.location! T^T ...在每个大巴(SpiderMonkey,犀牛...等)或ECMA – Integral