<IMG SRC="¹Ï¤ùÀÉ URL" onload="³B²z¤U¸ü§¹¦¨ªº Srcipt ±Ôz;">
var timerObj=setInterval("¹Ï¤ù¤U¸ü¬O§_§¹¦¨¤§Àˬd¨ç¼Æ()",¶¡¹j²@¬í¼Æ); /* setInterval °Ñ¼Æªº·N¸q¡G ²Ä¤@ӰѼƪí¥Ü¦¹¤@®É¶¡ÅX°Ê¾¹©T©wn°õ¦æªº Script ¨ç¼Æ¡A®æ¦¡¬O¨ç¼Æ¦WºÙ §À³¡¥[ () ¦¨¹ï¶ê¬A©·¡A¨Ã¥Î "" ¦r¤¸«e«á¥]§¨¡C ²Ä¤GӰѼƪí¥Ü¶¡¹j¦h¤Ö²@¬í°õ¦æ¦¹³]©w¨ç¼Æ¤@¦¸¡A®æ¦¡¬°¼ÆÈ¡C */
<SCRIPT> var ready=false; </SCRIPT> <BODY> <IMG SRC="¹Ï¤ùÀÉ URL" onload="ready=true;"> </BODY>¤W±ªº¥Î·N´N¬O«Å§i¤@Ó ready Åܼưµ¬°µù¼Ð¡A¤@¶}©l¥ý³]©w¬°°°È¡Aµ¥¨ì IMG ¼ÐÅÒªº¹Ï¤ù¤U¸ü§¹¦¨«á¡A´N§â ready ÅܼƧאּ¯uÈ¡C¦]¬°¦³¤F ready ³oÓµù¼Ð¡A §ÚÌ´N¥i¥H°õ¦æ¤U¦Cªº Script¡G
function ¹Ï¤ù¤U¸üÀˬd¨ç¼Æ() { /* ¦pªG¹Ï¤ù¤U¸ü§¹¦¨µù¼Ð¬°¯u¡A¨º»ò´N²×¤î®É¶¡ÅX°Ê¾¹ timerObj ªº¨Ï¥Î¡A ¨Ã¥BÂ÷¶}¥»¨ç¼Æ¡C */ if (ready) { clearInterval(timerObj); return; } /* ready ¬°°²®É¥»¨ç¼ÆÄ~Äò§PÂ_ªº¨ä¥L±Ôz ...... */ }¦bÀˬd¨ç¼Æ²Ä¤GÓn°µªº°Ê§@´N¬O¬Ý¬Ý¤U¸üµ¥«Ý®É¶¡¬O§_¶W¹L¡A³o¦P¼Ë¥i¥H«Å§i¤@Ó ®É¶¡°O¿ýÅܼƨӸѨM¡A¨Ò¦p¡G
var calc=0; function ¹Ï¤ù¤U¸üÀˬd¨ç¼Æ() { /* ¤U¸ü®É¶¡¶W¹L«ü©w¤§³Ì¤jµ¥«Ý®É¶¡¡A¨º»ò´N©ñ±ó¦¹¤@°»´ú¡A ¨Ã²×¤î®É¶¡ÅX°Ê¾¹ timerObj ªº¨Ï¥Î¡C */ if (calc > ³Ì¤jµ¥«Ý®É¶¡) {clearInterval(timerObj);} /* ®É¶¡°O¿ýÈ¥[ 1 */ calc++; }
<IMG NAME="loadbox" ...... >¨º»ò´N¥i¥H¦b Script ¥Î¤U±±Ôz¥h±Ò°Ê IMG ¹Ï¤ùªº¤U¸ü¡G
document.images.loadbox.src="·s¹Ï¤ùªº URL";¦Ó¨ú®ø IMG ¹Ï¤ùªº¤U¸üªº Script ±Ôz«h¦p¤U¡G
document.images.loadbox.src=null;
¥H¤W´N¬O¥»½d¨Ò³]pì²z¤j·§¡A±µ¤U¨Ó´N¬O¥»½d¨Òªº´ú¸Õ¡A¥»½d¨Ò¥u¦w±Æ¬ü´A©M»¶´A ¨â±i¹Ï¤ù¡A¤T¯Å´A¹ê»Ú¤W¬O¤£¦s¦bªº¹Ï¤ù¡C¤@¤è±¬O´ú¸ÕµLªk¤U¸ü¹Ï¤ùªº³B²z°Ê§@¡A ¤@¤è±¬O¥»¯¸Ë©³¤£¬O¦¨¤Hºô¯¸¡A¦Ñ©Ç¥i¨SÁx¤l¥hIJ¥Ç¤¤µØ¥Á°êªk«ß¡A¦pªG¦]¦¹Åý§A ¤j¥¢©Ò±æ¡AÁٽЦhì½Ì¡C
![]() |
¥H¤U¬O¥»½d¨Òì©l½X¥h°£»¡©ú³¡¥÷¡A¯d¤U¹Ï¤ù¤U¸ü¬ÛÃöªº HTML ©M Script¡C
<HTML> <HEAD> <SCRIPT LANGUAGE=JAVASCRIPT> <!-- /* checker:®É¶¡p¼Æ¾¹ª«¥ó«Å§i calc:p¼Æ¾¹¸g¹L¬í¼Æ°O¿ý ready:¤U¸ü§¹¦¨»P§_¤§µù¼ÐÅÜ¼Æ */ var checker,calc,ready; /* ¬O§_¥i¦A¦¸¸ü¤J¹Ï¤ù¤§±±¨îÅÜ¼Æ */ var startcheck=false; /* ¶}©l¸ü¤J¹Ï¤ù */ function StartLoading() { /* ¦pªGºô¶¨S¦³¥¿¦b°õ¦æ¹Ï¤ù¸ü¤J¥\¯à */ if (!startcheck) { /* µù©úºô¶¥¿¤U¸ü¹Ï¤ù¤¤¡AÁ×§KÂsÄýªÌ¥t¸ü¹Ï¤ù¡C */ startcheck=true; /* ¬í¼Æ°O¿ý¾¹Âk¹s */ calc=0; /* ±Nµù¼Ð§ï¬°©|¥¼§¹¦¨¸ü¤J¹Ï¤ù */ ready=false; document.forms.form1.elements.loadmessage.value="!!½Ðµy«Ý¹Ï¤ù¤U¸ü!!"; /* ¶}©l°õ¦æ¤U¸ü¹Ï¤ù¦Ûq¨ç¼Æ */ LoadPicture(); /* «Å§i®É¶¡p¼Æ¾¹¡A¨Ã 1000 ²@¬í°õ¦æ¹Ï¤ù¤U¸ü¬O§_§¹¦¨¤§ ¦Ûq´ú¸Õ¨ç¼Æ¤@¦¸¡C */ checker=setInterval("PicLoadCheck(30)",1000); } } /* ¦æ¹Ï¤ù¤U¸ü¬O§_§¹¦¨´ú¸Õ¨ç¼Æ °Ñ¼Æ max ªí³Ì¤jµ¥«Ý¬í¼Æ */ function PicLoadCheck(max) { /* ¹Ï¤ù¤U¸üª¬ªpÅã¥Ü°T®§ÅÜ¼Æ */ var str; /* ¦pªG®É¶¡p¼Æ¶W¹L³Ì¤jµ¥«Ý¬í¼Æ¡A´N§â ready=true ¡A«Å§i©ñ±ó°T®§¡C */ if (calc > max) {str="!!¤U¸ü¹Ï¤ù®É¶¡¤w¶W¹L "+calc+" ¬í¡A\n¤U¸ü²×¤î!!"; ready=true;document.images.loadbox.src=null;} else {str="¤U¸ü¹Ï¤ù§¹¦¨¡A\n¶O®É "+calc+" ¬í¡C";} /* ¦pªG¹Ï¤ù¤U¸üµù¼Ð³Q IMG loadbox ³qª¾§¹¦¨¡A©Î¹O®É³Q«Å§i©ñ±ó¡C */ if (ready) { /* «Å§i²×¤î®É¶¡p¼Æ¾¹ checker ªº¨Ï¥Î */ clearInterval(checker); /* ¶}©ñ¹Ï¤ù¦A¦¸¤U¸ü¥\¯à */ startcheck=false; /* Åã¥Ü¦¹¦¸¹Ï¤ù¤U¸üªº°T®§ */ document.forms.form1.elements.loadmessage.value=str; } /* ®É¶¡°O¿ý¥[ 1 */ calc++; } /* ¨Ì SELECT BOX sel1 ªº¿ï¶µ¨M©w¸ü¤J¨º±i¹Ï¤ù */ function LoadPicture() { /* ®ø¥hì¹Ï¤ù */ document.images.loadbox.src=null; var URL; var elem=document.forms.form1.elements.sel1; /* ¥Î°j°é³v¤@Àˬd¨C¿ï¶µ¬O§_³Q¿ï¨ú */ for (var i=0;i<elem.length;i++) /* ¥Î URL Åܼƨú±o OPTION ¿ï¶µ¤¤¹Ï¤ù¦ì§}ªº value È */ {if (elem[i].selected) {URL=elem[i].value;break;}} /* ¸ü¤J·s¹Ï¤ù */ document.images.loadbox.src=URL; } // --> </SCRIPT> </HEAD> <BODY> <H4 ALIGN=CENTER>¹Ï¤ù¤U¸ü®É¶¡°»´ú(IMG onload ¨Æ¥óªº§Q¥Î)</H4> <FORM NAME="form1"> ½Ð¦b¥k°¼¿ï¾Ü¸ü¤J¤§¹Ï¤ù¡G<BR> <SELECT NAME="sel1" onchange="StartLoading()"> <OPTION VALUE="00080000.gif">µL´A</OPTION> <OPTION VALUE="00080001.jpg">¬ü´A</OPTION> <OPTION VALUE="00080002.jpg">»¶´A</OPTION> <OPTION VALUE="00080003.jpg">¤T¯Å´A</OPTION> </SELECT><BR><BR> ¤U¸ü°T®§®Ø¡G<BR> <TEXTAREA NAME="loadmessage" COLS=22 ROWS=3> </TEXTAREA> </FORM> <IMG NAME="loadbox" SRC="00080000.gif" ALT="¹Ï¤ù¸ü¤J²°" WIDTH=150 HEIGHT=200 BORDER=1 onload="ready=true;"> <!-- IMG loadbox ¦b onload(¤U¸ü§¹¦¨)¨Æ¥óµo¥Í®É±Nµù¼ÐÅÜ¼Æ ready=true ªº¥Î·N¬O³qª¾p¼Æ¾¹¹Ï¤ù¤U¸ü¤w§¹¦¨¡C // --> </BODY> </HTML>