开发者

if url is AllItems.aspx then display none else AllItems.aspx?ID= display block

the script below doesn't seem to work!

what's wrong with it?

here is what i try to do:

if url is AllItems.aspx then display:none else AllItems.aspx?ID= display:block

开发者_JS百科
var url = location.pathname;
  if (document.URL.indexOf("AllItems.aspx")>= 0)  {
  jQuery("#logo").css("display","none");
  }
    else if (document.URL.indexOf("AllItems.aspx?ID=")>= 0)  {
  jQuery("#logo").css("display","block");
  }


the ?xxx part of URL can be read by location.search, thus the code may be:

if (location.search.length <= 1) { // may be only a '?'
    $('#logo').hide();
}
else {
    $('#logo').show();
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜