图片预先加载(模糊到清晰)

<!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=gb2312"> 

</head>

<body style="text-align:center">

<img src="images/small.jpg" name="myImage" width="1002" height="754" id="myImage"/>

<script language="JavaScript" type="text/javascript">

var img = new Image();

img.src = "images/mm.jpg";

img.onload = function() {

document.getElementById('myImage').src = this.src;

}

</script>

</div>

</body>

</html>

posted @ 2015-04-23 10:58  mrt_yy  阅读(344)  评论(0编辑  收藏  举报