<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>this</title>
</head>
<body>
<div>hello d1
<div>hello d2
<p>
<a onclick="show(this)" star="exorable">hello d3</a>
<!--此处this指当前的标签,this做定位更方便-->
</p>
<p>hello p2</p>
</div>
<p>hello p</p>

</div>
<script>
function show(self) {
console.log(self.getAttribute('star'));//exorable
}
</script>

</body>
</html>

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-19
  • 2021-06-12
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-12
  • 2022-12-23
  • 2021-08-29
相关资源
相似解决方案