<!DOCTYPE html>
<html>
<head>
<title>Test</title>
<meta charset="utf-8">
</head>
<body>
<button data-id="btn1">图一</button>
<button data-id="btn2">图二</button>
<div>
<img src="img/img1.jpg" />
</div>
</body>
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
<script>
$(function() {
$("button").click(function() {
if($(this).attr("data-id") === 'btn1') {
$("div").html("<img src=\"img/img1.jpg\"/>");
} else {
$("div").html("<img src=\"img/img2.jpg\"/>");
}
})
});
</script>
</html>