如何在外部获取当前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

posted @ 2015-01-27 20:58  记忆书签  阅读(669)  评论(0编辑  收藏  举报