Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

¼«¾­µäµÄJavaScript¿ò¼Üprototype.jsÖÐʵÏּ̳еķ½·¨

 ±¾ÎÄ·ÇÔ­´´
   
Object.extend = function(destination, source) {
for (var property in source) {
    destination[property] = source[property];
}
return destination;
}
Prototype ¶ÔObjectÀà½øÐеÄÀ©Õ¹Ö÷Ҫͨ¹ýÒ»¸ö¾²Ì¬º¯ÊýObject.extend(destination, source)ʵÏÖÁËJavaScriptÖеļ̳С£ ´ÓÓïÒåµÄ½Ç¶È, Object.extend(destination, source)·½·¨ÓÐЩ²»ºÍÂß¼­, ÒòΪËüÊÂʵÉϽö½öʵÏÖÁË´ÓÔ´¶ÔÏóµ½Ä¿±ê¶ÔÏóµÄÈ«Ï¢¿½±´¡£²»¹ýÄãÒ²¿ÉÒÔÕâÑùÈÏΪ£ºÓÉÓÚÄ¿±ê¶ÔÏóÓµÓÐÁËËùÓÐÔ´¶ÔÏóËùÓµÓеÄÌØÐÔ, ËùÒÔ¿´ÉÏÈ¥¾ÍÏñÄ¿±ê¶ÔÏó¼Ì³ÐÁËÔ´¶ÔÏó(²¢¼ÓÒÔÀ©Õ¹)Ò»Ñù¡£ÁíÍâ, Prototype¶ÔObjectÀ©Õ¹Á˼¸¸ö±È½ÏÓÐÓõľ²Ì¬·½·¨, ËùÓÐÆäËûµÄÀà¿ÉÒÔͨ¹ýµ÷ÓÃÕâЩ¾²Ì¬·½·¨»ñÈ¡Ö§³Ö¡£
JScript code 
Object.extend = function(destination, source) { // Ò»¸ö¾²Ì¬·½·¨±íʾ¼Ì³Ð, Ä¿±ê¶ÔÏó½«ÓµÓÐÔ´¶ÔÏóµÄËùÓÐÊôÐԺͷ½·¨
for (var property in source) {
    destination[property] = source[property];   // ÀûÓö¯Ì¬ÓïÑÔµÄÌØÐÔ, Í¨¹ý¸³Öµ¶¯Ì¬Ìí¼ÓÊôÐÔÓë·½·¨
}
return destination;   // ·µ»ØÀ©Õ¹ºóµÄ¶ÔÏó
}
Object.extend(Object, { 
inspect: function(object) {   // Ò»¸ö¾²Ì¬·½·¨, ´«ÈëÒ»¸ö¶ÔÏó, ·µ»Ø¶ÔÏóµÄ×Ö·û´®±íʾ
    try {
      if (object == undefined) return 'undefined'; // ´¦ÀíundefinedÇé¿ö
      if (object == null) return 'null';     // ´¦ÀínullÇé¿ö
      // Èç¹û¶ÔÏó¶¨ÒåÁËinspect·½·¨, Ôòµ÷Óø÷½·¨·µ»Ø, ·ñÔò·µ»Ø¶ÔÏóµÄtoString()Öµ
      return object.inspect ? object.inspect() : object.toString(); 
    } catch 


Ïà¹ØÎĵµ£º

FirefoxºÍIEÖ®¼ä7¸öJavaScript²îÒì

¾¡¹Ü JavaScript ÀúÊ·ÉÏʹÓÃÈß³¤¶øÁîÈËÉúÑáµÄ´úÂë¿éÀ´±êµÄÌض¨ä¯ÀÀÆ÷µÄʱÆÚÒѾ­½áÊøÁË£¬µ«ÊÇż¶ûʹÓÃһЩ¼òµ¥µÄ´úÂë¿éºÍ¶ÔÏó¼ì²âÀ´È·±£Ò»Ð©´úÂëÔÚÓû§»úÆ÷ÉÏÕý³£¹¤×÷ÒÀÈ»ÊDZØÒªµÄ¡£
ÕâƪÎÄÕÂÖУ¬ÎÒ»áÂÔÊöһϠInternet Explorer ºÍ Firefox ÔÚ JavaScript Óï·¨Éϲ»Í¬µÄ 7 ¸ö·½Ãæ¡£
1. CSS “float” ÊôÐÔ
»ñÈ¡ ......

[´ÓjQuery¿´JavaScript]

 jQueryƬ¶Î£º
(function(){
//ÕâÀïºöÂÔjQueryËùÓÐʵÏÖ
})();
¡¡¡¡°ëÄêÇ°³õ´Î½Ó´¥jQueryµÄʱºò£¬ÎÒÒ²ÏñÆäËûÈËÒ»ÑùºÜÐ˷ܵØÏë¿´¿´Ô´ÂëÊÇʲôÑùµÄ¡£È»¶ø£¬ÔÚ¿´µ½Ô´ÂëµÄµÚÒ»ÑÛ£¬ÎÒ¾ÍÃÔºýÁË¡£ÎªÊ²Ã´Ö»ÓÐÒ»¸öÄäÃûº¯ÊýÓÖû¿´µ½ÔËÐУ¨µ±È»ÊÇÔËÐÐÁË……£©£¬¾ÍÄÜÓÐjQueryÕâô¸öº¯Êý¿âÁË£¿ÓÚÊÇ£¬ÎÒ±§×ÅÒÉÎÊÀ´µ½ ......

JavaScript ÑÕÉ«ÌݶȺͽ¥±äЧ¹û¸üÐÂ

½üÀ´¿´ÁËDeanµÄ“Convert any colour value to hex in MSIE”£¬ÖÕÓÚ½â¾öÁ˸ù¾Ý¹Ø¼ü×Ö»ñÈ¡ÑÕÉ«rgbÖµµÄÎÊÌâ¡£
˳±ã°Ñ³ÌÐòÒ²ÖØÐÂÕûÀíÒ»·¬£¬²¢Ê¹ÓÃÁË×î½üÕûÀíµÄ¹¤¾ß¿â¡£
Ч¹ûÔ¤ÀÀµ½ÕâÀï
ÏÂÔØÍêÕûʵÀý
³ÌÐò˵Ã÷
¡¾ColorGradsÑÕÉ«Ìݶȡ¿
³ÌÐòColorGradsµÄ×÷ÓÃÊǸù¾ÝÑÕÉ«¼¯ºÏºÍ½¥±ä¼¶ÊýÉú³ÉÑÕÉ«Ìݶȼ¯ºÏ¡£
½¥±ä¼ ......

JavaScriptÖеĹ«ÓгÉÔ±£¬Ë½ÓгÉÔ±ºÍ¾²Ì¬³ÉÔ±

˽ÓгÉÔ±¾ÍÊÇÔÚÀàµÄÄÚ²¿ÊµÏÖÖпÉÒÔ¹²ÏíµÄ³ÉÔ±¡£µ«ÊDz¢²»¶ÔÍ⹫¿ª£¬JavaScriptÖв¢Ã»ÓÐÌØÊâµÄ»úÖÆÀ´¶¨Òå˽ÓгÉÔ±£¬µ«ÊÇ¿ÉÒÔÓÃһЩ¼¼ÇÉÀ´ÊµÏÖÕâ¸ö¹¦ÄÜ¡£Ö÷ÒªÊÇͨ¹ý±äÁ¿µÄ×÷ÓÃÓòÐÔÖÊÀ´ÊµÏֵģ¬ÔÚÒ»¸öº¯ÊýÄÚ²¿¶¨ÒåµÄ±äÁ¿³ÆΪ¾Ö²¿±äÁ¿£¬¸Ã±äÁ¿²»Äܱ»º¯ÊýÍâµÄ³ÌÐòËù·ÃÎÊ£¬¿ÉÒÔ±»º¯ÊýÄÚ²¿¶¨ÒåµÄǶÌ׺¯ÊýËù·ÃÎÊ¡£
ÔÚÀàµÄ¹¹Ô캯ÊýÖÐ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ