<!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>
<title></title>
<style type="text/css">
.imgclass{width:200px;height:100px;}
</style>
<script src="jquery-1.9.1.js" type="text/javascript"></script>
<script type="text/javascript">
function showinfo() {
$(document).ready(function () {
alert($('#img1').attr('str'));
})
}
function updateimg() {
$('#img1').addClass('imgclass');
}
</script>
</head>
<body>
<img id="img1" src="images/1.jpg" />
<input id="Button1" type="button" value="button" οnclick="showinfo();" />
<br />
<input id="Button2" type="button" value="设置图片" οnclick="updateimg();" />
</body>
</html>