nextSlbling属性 获取某个节点后面的第一个节点(可能是标签 文本)

  判断获取的节点是否为标签节点还是文本节点

window.onload=function(){
var pagecount={$page_count};
document.getElementById('firsts').setAttribute('class','disabled');
document.getElementById('before').setAttribute('class','disabled');
var current=document.getElementById('before').nextSibling;
while(current.nodeType != 1){      根据nodeType判断节点属性
current=current.nextSibling;
}
current.setAttribute('class','current');
if(pagecount==1){
document.getElementById('next').setAttribute('class','disabled');
document.getElementById('last').setAttribute('class','disabled');
}
}

 

相关文章:

  • 2022-12-23
  • 2021-08-30
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-11
  • 2021-10-28
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-11-09
  • 2021-09-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案