javascript ÔØÈëͼƬºóÖ´ÐÐij²Ù×÷
function EnhancedImage(src,onLoaded){
var self = this;
this.src = src;
this.width = 0;
this.height = 0;
this.onLoaded = onLoaded;
this.loaded = false;
this.image = null;
this.load = function(){
if(this.loaded)
return;
this.image = new Image();
this.image.src = this.src;
function loadImage(){
if(self.width != 0 && self.height != 0){
clearInterval(interval);
self.loaded = true;
self.onLoaded(self);//½«ÊµÀý´«Èë»Øµ÷º¯Êý
}
self.width = self.image.width;//ÊÇnumberÀàÐÍ
self.height = self.image.height;
}
var interval = setInterval(loadImage,100);
}
}
function onImageLoad(image){
document.getElementById('banner').appendChild(image.image);
}
var img = new EnhancedImage("somthing.jpg",onImageLoad);
img.load();
newÒ»¸öImage¶ÔÏó£¬ÉèÖÃÁËsrcÊôÐÔ¹ýºó£¬²»¶ÏµÄ¼ì²éÐèÒªÔØÈëµÄͼƬµÄ¿íºÍ¸ß£¬Èç¹ûÔØÈëͼƬ³É¹¦µÄ»°£¬¿íºÍ¸ß¶¼ÊDz»Îª0µÄÊýÖµ£¬Õâ¸öʱºòÍ£Ö¹Interval £¬²¢ÇÒÖ´ÐÐonLoaded¡£
Ïà¹ØÎĵµ£º
<script>
///Óû§Êý¾Ý½á¹¹
function _tagUser()
{
this.UserId = 0; //0-4
this.UserName = ""; //5-
this.Parse = function(VarTypeUser)
{
for (var i=0;i<VarTypeUser.length;i++)
VarTypeUser[i] = String.fro ......
JavaScriptʼþ°ó¶¨µÄ·½·¨ËµÃ÷ ÊÕ²Ø
ʼþʹµÃ¿Í»§¶ËµÄ JavaScript Óлú»á±»¼¤»î£¬²¢µÃÒÔÔËÐС£ÔÚÒ»¸ö Web Ò³Ãæ×°ÔØÖ®ºó£¬ÔËÐнű¾µÄΨһ·½Ê½£¬¾ÍÊÇÏìӦϵͳ»òÕßÓû§µÄ¶¯×÷¡£ËäÈ»´ÓµÚÒ»¸öÖ§³Ö½Å±¾±à³ÌµÄä¯ÀÀÆ÷ÃæÊÀÒÔÀ´£¬¼òµ¥µÄʼþ±»ÊµÏÖΪ JavaScript µÄÒ»²¿·Ö£»µ«ÊÇ´ó¶àÊý×î½ü³öÏÖµÄä¯ÀÀÆ÷¶¼ÊµÏÖÁËǿ׳µÄʼþÄ£ÐÍ£¬Ê¹½Å± ......
Javascript ÔÐͺͼ̳Ð(Prototypes and Inheritance) ÊÕ²Ø
Ç°ÃæÎÒÃÇ¿´µ½ÁËÈçºÎʹÓà constructor À´³õʼ»¯¶ÔÏó¡£Èç¹ûÕâÑù×ö£¬ÄÇôÿһ¸ö´´½¨µÄжÔÏó¶¼»á¶ÔÄÇЩÏàͬµÄÊôÐÔ£¬·½·¨½¨Á¢Ò»¸ö¶ÀÁ¢µÄ¸±±¾¡£¶øÊµ¼ÊÉÏÓиü¼ÓÓÐЧµÄ·½·¨À´Ö¸¶¨·½·¨£¬³£Á¿£¬ÒÔ¼°ÆäËûһЩ¿É±»ËùÓиÃÀàµÄ¶ÔÏó¹²ÏíµÄÊôÐÔ¡£
JavaScript ¶ÔÏó´ÓÒ»¸ö ......
1. document ʵ¼ÊÉÏÊÇ window ¶ÔÏóµÄÊôÐÔ.ÓÃÓÚ·ÃÎÊÎĵµµÄÐÅÏ¢.
alert(window.document == document); //outputs "true"
2. location ¶ÔÏóÊÇ window ¶ÔÏóºÍ document ¶ÔÏóµÄÊôÐÔ,ËùÒÔÏÂÃæÁ½¸öÒýÓû¥ÏàµÈ¼Û.ÓÃÓÚ·ÃÎÊURLµÄÐÅÏ¢.
window.location;
document.location;
3. n ......
javascript
µÄ±àÂëÄÜÁ¦±È½ÏÈõ£¬µ«²¢²»´úÂëËü²»ÄÜ×ö£¬Ö»²»¹ý£¬ÐèÒªÄ㻨һµã¹¦·ò£¬Ç°¶Îʱ¼äÔÚ×öÈÕÀúµÄʱºò£¬ÐèÒª´Ótextbox¶ÁÈ¡ÈÕÆÚ£¬ÎÊÌâµÄ¹Ø¼üÊÇtextbox
µÄÈÕÆÚ¿ÉÄÜÊÇÃÀ¹ú±ê×¼£¬¿ÉÄÜÊÇÖйú±ê×¼µÈµÈ£¬Ã»Óа취½«Ö®×ª³ÉÈÕÆÚ¸ñʽ£¬Ò²¾Í²»Äܽ«ÈÕÆÚÔÚÈÕÀúÖж¨Î»µ½µ±Ìì¡£ÔÚcsdnÉÏÎÊÁËÒ»¸öÎÊÌ⣬½á¹ûûÓÐÈË´ðµÃºÏ
ÊÊ£¬ÎÒÒ»ÅÖ ......