利用indexof判断url中的字段,修改其下内容

var c_url=location.href;
  console.log(c_url)
var c_selection=c_url.indexOf('selection');
  console.log(c_selection)
if(c_selection != -1){
  var c_ahref=document.getElementsByClassName("bgimg")[0];
  c_ahref.href="javascript:void(0)";
}

posted @ 2017-10-11 09:44  小菜波  阅读(1126)  评论(0编辑  收藏  举报