<script>
var testEle = document.getElementById("test");   
testEle.setAttribute("demo");   
</script>

<a href="#" id="test" demo="1" onclick="alert(this.attributes['demo'].nodeValue)">(1)有</a>

<a href="#" id="test" demo="2" onclick="alert(this.attributes['demo'].nodeValue)">(2)无</a>

 

相关文章:

  • 2021-12-28
  • 2021-07-22
  • 2022-02-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-27
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-24
  • 2021-11-04
  • 2022-12-23
  • 2021-10-19
相关资源
相似解决方案