JS案例:网页加载时对图片进行缩小设置

来自CloudWiki
跳转至: 导航搜索
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>网页加载图片</title>
<script type="text/javascript">
  	function blow(){
		var img1=document.getElementById("img1");
		img1.width=img1.width-80;	
		}	
  	function reduce(){
		alert("迎下次光临本网页!");
		}
	</script>
 </head>
<body onload="blow()">
<img id="img1" src="images/3.jpg"/>
</body>
</html>