<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<div id="test">
<ul>
<li><a>this one</a></li>
<li><a>this two</a></li>
<li><a>this three</a></li>
</ul>
</div>
<script>
cat
= { Method: function test() {
var links = document.getElementsByTagName('a');
for (var i in links) {
links[i].tName
= links[i].innerText;
links[i].onclick
= function () {
alert(
" i am " + this.tName);
}
}
}
}
cat.Method();
</script>
</body>
</html>


 

相关文章:

  • 2022-12-23
  • 2021-11-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-01-12
  • 2022-12-23
  • 2022-12-23
  • 2022-02-09
  • 2021-04-29
  • 2022-12-23
  • 2021-11-17
相关资源
相似解决方案