在js自定义函数中使用$(event.target)代替$(this)

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script src="http://lib.sinaapp.com/js/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
function myajax(event){
    alert($(event.target).html())
}
</script>
</head>
<body>
<a class="ajaxa" onclick="myajax(event)" >子栏目和文章</a>

</body>
</html>

 

posted on 2014-04-28 18:19  左小兵  阅读(729)  评论(0编辑  收藏  举报

导航