87,907
社区成员
发帖
与我相关
我的任务
分享
<!DOCTYPE html>
<html>
<head>
<title></title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.js" type="text/javascript"></script>
<script type="text/javascript">
function scale(obj){
if($(obj).attr("max")==0){
$(obj).attr("max","1");
$("#div1").css("width","100%");
$("#img1").width($("#div1").width()-15);
}else{
$(obj).attr("max","0");
$("#div1").css("width","110px");
$("#img1").width($("#div1").width()-15);
}
}
</script>
</head>
<body>
<input type="button" onclick="scale(this)" max="0" value="缩放" />
<div id="div1" style="border:solid 1px red;width:110px;" >
<img id="img1" alt="" src="http://avatar.profile.csdn.net/8/A/4/1_wbb123yu.jpg" />
</div>
</body>
</html>