实现一段脚本,使得点击对应链接alert出相应的编号,比如点击第一个链接就alert 1。
html
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<body>
<a href='#'> 第一个链接 </a> </br>
<a href='#'> 第二个链接 </a> </br>
<a href='#'> 第三个链接 </a> </br>
<a href='#'> 第四个链接 </a> </br>
</body>
这样?
方法一:
方法二: