日期:2014-05-16 浏览次数:20476 次
<script type="text/javascript">
function click(){
//
}
</script>
<div id="div">
<img id="image" src="1.png" onclick="click()"/>
<p id="p">item1</p>
</div>
<div id="div">
<img id="image" src="1.png" onclick="click()"/>
<p id="p">item2</p>
</div>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" type="text/javascript"></script>
<title>无标题文档</title>
<script type="text/javascript">
function click(){
//ETC
}
</script>
</head>
<body>
<div id="div">
<img id="image1" src="0.png"/>
<p id="p">item1</p>
</div>
<div id="div2">
<img id="image" src="0.png"/>
<p id="p">item2</p>
</div>
<script type="text/javascript">
jQuery(function($){
$('img').click(function(e){
alert($(e.target).parent().find('p').html());
});
});
</script>
</body>
</html>