Méthode 1:
La copie de code est la suivante:
<script type = "text / javascript">
var obj = nouvelle image ();
obj.src = "yourpicurl.jpg";
obj.onload = function () {// Cet endroit peut être écrit à plusieurs reprises.
document.getElementById ("mypic"). innnerhtml = "<img src = '" + this.src + "' />";
}
</cript>
<div id = ”mypic”> onloking… </div>
Méthode 2:
La copie de code est la suivante:
<script type = "text / javascript">
var obj = nouvelle image ();
obj.src = "yourpicurl.jpg";
obj.onreadystatechange = function () {
if (this.readystate == "complet") {// Cet endroit peut être écrit à plusieurs reprises.
document.getElementById ("mypic"). innnerhtml = "<img src = '" + this.src + "' />";
}
}
</cript>
<div id = ”mypic”> onloking… </div>
Méthode 3:
La copie de code est la suivante:
<! 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">
<adal>
<meta http-equiv = "contenu-type" contenu = "text / html; charset = utf-8" />
<Title> UNT intitulé Document </Title>
</ head>
<Script Language = "JavaScript" src = "/ js / jquery-1.4.4.js" type = "text / javascript">
</cript>
<script lingots = "javascript" type = "text / javascript">
<! - // var total; var Curt = 0; $ (document) .ready (function ()
{{
Total = $ ("# contenu img"). Longueur;
$ ("# contenu img"). chaque (fonction () {var image = new image ();
image.src = $ (this) .attr ('src');
if (image.comptete) {
ImageLoaded ();
}
autre {
Image.onLoad = ImageLoaded;
}
});
});
fonction ImageLoaded () {
Curt + = 1;
if (Curt == Total) {
$ ("# contenu"). show ();
}} // ->
</cript>
</ head>
<body>
<div id = "contenu" style = "affichage: aucun;"
<img src = "" />
<img src = "" />
<img src = "" />
</div>
</docy>
</html>