<!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>
在js自定义函数中使用$(event.target)代替$(this),码迷,mamicode.com
时间: 2024-10-14 01:01:02