如何在外部获取当前A标签的ID值
<div class="diskmain"> <ul id="folder"> <li><span class='documents'><a href='javascript:void(0)' id='1' onclick='getid(this);'>分类A</a></span></li> <li><span class='lists'><a href='javascript:void(0)' id='2' onclick='getid(this);'>分类B</a></span></li> <li><span class='pictures'><a href='javascript:void(0)' id='3' onclick='getid(this);'>分类C</a></span></li> <li><span class='share'><a href='javascript:void(0)' id='4' onclick='getid(this);'>分类D</a></span></li> </ul> </div> <script> function getid(a){ alert(a.id) }; </script>
转载自:http://blog.csdn.net/asdf1213321/article/details/8752061
可以发牢骚,但是必须要努力奋斗!