방법 1 : 방법 1
코드 사본은 다음과 같습니다.
<script type = "text/javaScript">
var obj = new image ();
obj.src = "yourpicurl.jpg";
obj.onload = function () {//이 장소는 반복적으로 쓸 수 있습니다.
document.getElementById ( "mypic"). innnerhtml = "<img src = '"+this.src+" />";
}
</스크립트>
<div id = "mypic"> onloading… </div>
방법 2 : 방법 2.
코드 사본은 다음과 같습니다.
<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+" />";
}
}
</스크립트>
<div id = "mypic"> onloading… </div>
메소드 3 :
코드 사본은 다음과 같습니다.
<! 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">
<헤드>
<meta http-equiv = "content-type"content = "text /html; charset = utf-8" />
<title> 제목의 문서 </title>
</head>
<script language = "javaScript"src = "/js/jquery-1.4.4.js"type = "text/javaScript">
</스크립트>
<script language = "javaScript"type = "text/javaScript">
<!-// var total; var curt = 0; $ (document) .ready (function ()
{
Total = $ ( "#content img"). 길이;
$ ( "#content img"). 각 (function () {var image = new Image ();
image.src = $ (this) .attr ( 'src');
if (image.complete) {
imageloaded ();
}
또 다른{
image.onload = imageloaded;
}
});
});
함수 imageloaded () {
curt+= 1;
if (curt == Total) {
$ ( "#content"). show ();
}} //->
</스크립트>
</head>
<body>
<div id = "content"style = "display : none;"
<img src = "" />
<img src = "" />
<img src = "" />
</div>
</body>
</html>