方法一:
复制代码 代码如下:
<script type=”text/javascript”>
var obj = new Image();
obj.src = “yourpicurl.jpg”;
obj.onload = function() { //这个地方可以重复写入,如果错误的话,换到外面即可
document.getElementById(”mypic”).innnerHTML = “<img src='”+this.src+”‘ />”;
}
</script>
<div id=”mypic”>onloading……</div>
方法二:
复制代码 代码如下:
<script type=”text/javascript”>
var obj = new Image();
obj.src = “yourpicurl.jpg”;
obj.onreadystatechange = function() {
if ( this.readyState == “complete”) { //这个地方可以重复写入,如果错误的话,换到外面即可
document.getElementById(”mypic”).innnerHTML = “<img src='”+this.src+”‘ />”;
}
}
</script>
<div id=”mypic”>onloading……</div>
方法三:
复制代码 代码如下:
<!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=utf-8" />
<title>无标题文档</title>
</head>
<script language="javascript" src="http://www.jb51.netjs/jquery-1.4.4.js" type="text/javascript">
</script>
<script language="javascript" type="text/javascript">
<>
</script>
</head>
<body>
<div id="content" >
<img src="" />
<img src="" />
<img src="" />
</div>
</body>
</html>