Version compl�te: jsB@nk » Divers » xImgAsyncWait
URL: https://www.javascriptbank.com/sliders-ximgasyncwait.html
xImgAsyncWait attend de manière asynchrone (et surveille l'état) des entreprises nouvellement créées ou des images statiques. Peut être appelée avant ou après window.onload, ou dans le code HTML suivant le dernier élément IMG. Au cours de la surveillance des image l'état de charge, votre état la fonction sera appelée à chaque itération. Après avoir réussi à charger toutes les images, la fonction d'initialisation de votre application est appelée. Si une image ne parvient pas à charger, le message d'erreur fonction est appelée. Vous pouvez fournir à l'erreur et annuler des images pour ceux qui ne réussissent pas à charger.
Version compl�te: jsB@nk » Divers » xImgAsyncWait
URL: https://www.javascriptbank.com/sliders-ximgasyncwait.html
<link rel="stylesheet" type="text/css" href="v3.css"><!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->
<script type="text/javascript">window.onload = function(){ if (window.winOnLoad) window.winOnLoad();}</script><script type="text/javascript" src="x_img.js"></script><script type="text/javascript">/* There are three different ways to use xImgAsyncWait(). 1. Create new images and call it before the onload event. 2. Create new images and call it after the onload event. 3. Call it in the HTML immediately after the last IMG element. In 1 and 2 it will monitor the status of the newly created images because you pass it an array of the new img objects. In 3 it will monitor the status of all static images because you do not pass it an array.*/var aImgs = new Array();/***// If new images are created before the window.onload event:newImg('../../images/grn_bnr1.jpg');newImg('../../images/cbe.gif');newImg('../../images/mars.jpg');newImg('../../images/news.gif');newImg('../../images/search.gif');newImg('../../images/x.gif');newImg('../../images/xbanner.gif');newImg('../../images/noExist1.jpg');newImg('../../images/noExist2.jpg');log('', true);xImgAsyncWait(imgLoadStatus, appInitialize, appImgError, 'noExist1.jpg', 'noExist2.jpg', aImgs);***/function winOnLoad(){ // A splash page could be positioned and displayed here. // If new images are created after the window.onload event newImg('../image/logojs.gif'); newImg('../image/logojs.gif'); newImg('../image/logojs.gif'); newImg('../image/logojs.gif'); newImg('../image/logojs.gif'); newImg('../image/logojs.gif'); newImg('../image/logojs.gif'); newImg('../image/logojs.gif'); newImg('../image/logojs.gif'); log('', true); xImgAsyncWait(imgLoadStatus, appInitialize, appImgError, 'noExist1.jpg', 'noExist2.jpg', aImgs); // At this point our code continues to run but // we're still waiting for images to load. // Don't do anything here relating to images, // do it in appInitialize().}// After all images have loaded successfully// then this function will be called:function appInitialize(){ // The splash page (if any) would be removed here. // Finish application initializations, // for example adding rollover event listeners.}// If any image was not loaded due to an error or an abort// then this function will be called instead of appInitialize:function appImgError(n, c, e, a){ var s = '\nFinal Image Status:' + '\n total=' + n + '\n loaded=' + c + '\n errors=' + e + '\n aborts=' + a; log(s);}// This function is called at each iteration of image status monitoring:function imgLoadStatus(n, c, e, a){ var s = '\nImage Status:' + '\n total=' + n + '\n loaded=' + c + '\n errors=' + e + '\n aborts=' + a; log(s);}// Utility functions for this demofunction newImg(sUrl){ var i = aImgs.length; aImgs[i] = new Image(); aImgs[i].src = sUrl;}function log(s, bOverwrite){ var log = document.getElementById('debugLog'); if (log) { if (bOverwrite) log.value = s; else log.value += s; }}</script><!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->
<form><textarea id="debugLog" rows="24" cols="30"></textarea></form><!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->
http://javascriptbank.com/javascript/misc/Sliders/v3.csshttp://javascriptbank.com/javascript/misc/Sliders/x_img.js