JavascriptµÄÔÐͶÔÏóºÍprototypeÊôÐÔ
JavascriptÖеļ̳лúÖÆÊÇËùνµÄÔÐͶÔÏó¼Ì³Ð£¬Í¨¹ýÊôÐÔ·ÃÎÊ»úÖƵÄÌØÊâÐÔÀ´ÊµÏּ̳еġ£Ö®Ç°ÎÒÒ»Ö±ÒÔΪËùÓжÔÏóµÄÔÐͶÔÏó¾ÍÊÇprototypeËùÖ¸µÄÄǸö¶ÔÏ󡣺óÀ´ÔÚ¿´javascriptÉè¼ÆģʽµÄʱºò·¢ÏÖ×÷Õß×¢ÖÐÓÐÒ»¾ä»°ÓëÎÒ֮ǰµÄÀí½â²»Í¬£¬Ëû˵“ÿ¸ö¶ÔÏó¶¼ÓÐÒ»¸öÔÐͶÔÏ󣬵«Õâ²¢²»Òâζ×Åÿ¸ö¶ÔÏó¶¼ÓÐÒ»¸öprototypeÊôÐÔ”¡£¿´ÍêÎÒ¾ÍÓеãÃÔãÁË£¬¾ö¶¨³¹µ×°ÑÕâ¸öËÀÈ˵ÄÔÐͼ̳иã¸ãÇå³þ¡£È»ºó·ÁËЩÎÄÕºÍÊé¼®£¬×îºóÖÕÓÚÔÚjavascriptȨÍþÖ¸ÄϵÚÎå°æÖÐÕÒµ½Á˸öÈË ÈÏΪ±È½ÏȨÍþµÄ½âÊÍ¡£¹ØÓÚÔÐÍÁ´ºÍÊôÐÔ·ÃÎÊ»úÖÆÎҾͲ»ÔÙ²ûÊöÁË£¬Õâ·½Ãæ¿ÉÒÔ¿´¿´RockyµÄÎÄÕ дµÄÂùÇå³þµÄ http://blog.csdn.net/rocky_j2ee/archive/2009/03/21/4012385.aspx
ÄÇÎÒÃÇÏÈ´Ó´´½¨¶ÔÏó˵Æð£¬ÓÃnew²Ù×÷·û´´½¨¶ÔÏóµÄʱºòjavascript»á×ö3¼þÊ£º
Ê×ÏÈÊÇ´´½¨Ò»¸ö¿Õ¶ÔÏó£¨empty object£©£¬
È»ºó¶ÔÕâ¸ö¿Õ¶ÔÏóµÄÔÐͶÔÏó½øÐи³Öµ£¬
×îºó°ÑÕâ¸ö¿Õ¶ÔÏó¸³Öµ¸ø¹¹Ô캯ÊýµÄthisÊôÐÔÇÒÔËÐÐÕâ¸ö¹¹Ô캯Êý¡£
function Person(name) {
this.name = name;
}
var p = new Person();
Ï൱ÓÚÒÔϲ½Ö裺
1. Var p = {};
2. p.[[prototype]] = Person.prototype
//ÕâÒ»²½ÊÇα´úÂ룬ʵ¼ÊÉÏÒ»¸ö¶ÔÏóµÄÔÐͶÔÏóÊDz»ÄÜͨ¹ý´úÂëÀ´·ÃÎʵģ¬
//ÕâÀïÖ»ÊÇΪÁË˵Ã÷´´½¨¶ÔÏóµÄ²½Öè
3. p.methodName = Person
; //ÕâÑùµÄ»°PersonµÄthis¾Í»áÖ¸Ïòp
p.methodName();
Èç¹ûÄã¶ÔµÚ¶þ²½²»ÊǺÜÃ÷°×£¬ÄÇôÏÈ°Ñ´úÂë·ÅÒ»·Å£¬½ÓÏÂÀ´ÎÒ»áÏêϸ½âÊÍϵڶþ²½ÔÐͶÔÏóµÄ¸³Öµ£¨»òÕß˵¹¹Ô캯ÊýºÍÔÐͶÔÏóµÄ¹Øϵ£©:ÉÏÃæÎÒÌáµ½¹ýÔÚ´´½¨ÍêÒ»¸ö¿Õ¶ÔÏóºó£¬»á³õʼ»¯Õâ¸ö¿Õ¶ÔÏóµÄÔÐͶÔÏó£¬javascript»á°Ñ¹¹Ô캯ÊýµÄÒ»¸ö½Ð×öprototypeµÄÊôÐÔËùÖ¸ÏòµÄ¶ÔÏó¸³Öµ¸øµ±Ç°¿Õ¶ÔÏóµÄÔÐͶÔÏó¡£ËùÓеÄfunction¶¼ÓÐÒ»¸öprototypeÊôÐÔ£¬µ±Ò»¸öfunction±»¶¨ÒåÖ®ºóÕâ¸öÊôÐԻᱻ×Ô¶¯µÄ´´½¨ºÍ³õʼ»¯¡£Ò»¸öfunction µÄprototypeÊôÐԵijõʼֵÊÇÒ»¸ö¶ÔÏó£¨an object£©£¬Õâ¸ö¶ÔÏóÖ»ÓÐÒ»¸öÊôÐÔ½Ð×öconstructor£¬¶øÕâ¸öconstructor µÄÖµ¾ÍÊǵ±Ç°Õâ¸öº¯Êý£¨»òÕß½
Ïà¹ØÎĵµ£º
×î½üһֱΪ´ËÍ·Í´£¬¹ÃÇÒ°ÑÎÒÄÜÏëµ½µÄ¶«Î÷¶¼Ð´³öÀ´°É¡£ÓÉÓÚ²»ÊǼòµ¥°ÑÒ³ÃæÉÏÊÖдµÄscriptתΪjavascriptÌí¼Ó£¬ÎÒÃÇÐèÒª¿¼ÂǵĶ«Î÷Ö÷ÒªÓÐÁ½¸ö£º¼ÓÔصÄ˳Ðò£¬¼ÓÔØÇ°ºó½Å±¾µÄÔË×÷¡£
ÏÈ˵µÚÒ»¸ö£¬¼ÙÈçÎÒÃÇÒÑÓÐÒ»¼ÓÔØ»úÖÆÁË£¬Òª¼ÓÔØÒ»¸öÐÂÄ£¿é£¬µ±È»ÐÂÄ£¿éÊÇÔÚÁíÒ»¸öJSÎļþÖС£Õâʱ£¬ÎÒÃÇ¿ÉÒÔÃèÊöΪ£º
loader ---> a.js
Õâ¸ö¼Ó ......
javascriptÖÐevent.keycode
keycode 8 = BackSpace BackSpace
keycode 9 = Tab Tab
keycode 12 = Clear
keycode 13 = Enter
keycode 16 = Shift_L
keycode 17 = Control_L
keycode 18 = Alt_L
keycode 19 = Pause
keycode 20 = Caps_Lock
keycode 27 = Escape Escape
keycode 32 = space space ......
1. ¶¨ÒåÒ»¸öÓÃÓÚÊä³öJavaScript´úÂë µÄServletÀà¡£
package com.mycompany.response.servlet;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServle ......
ÀàÊÇʲô£¿
Ðí¶à¸Õ½Ó´¥±à³ÌµÄÅóÓѶ¼¿ÉÄÜÀí½â²»ÁËÀ࣬ÆäʵÀàÊǶÔÎÒÃÇÕâ¸öÏÖʵÊÀ½çµÄÄ£Ä⣬°ÑËü˵³É“Àà±ð”»òÕß“ÀàÐÍ”¿ÉÄÜ»á¸üÈÝÒ×Àí½âһЩ¡£±ÈÈç“ÈË”ÕâÖÖ¶¯
Îï¾ÍÊÇÒ»¸öÀ࣬¶ø¾ßÌåijһ¸öÈ˾ÍÊÇ“ÈË”Õâ¸öÀàµÄÒ»¸öʵÀý
£¬
“È ......
JDK6ÒѾ·¢²¼ºÜ¾ÃÁË£¬ºÜÔç¾ÍÌý¹ýËûÒѾ֧³Ö½Å±¾ÓïÑÔÁË£¬²»¹ýһֱûÓÐʱ¼ä³¢ÊÔ£¬½ñÌì͵ÏÐÊÔÁËһϣ¬¸Ð¾õ²»´í¡£
¡¡¡¡javax.script°üËüÊÇJavaÐÂÔöµÄ²Ù×÷½Å±¾µÄ¹¤¾ß°ü£¬
¡¡¡¡ÀûÓÃËüÎÒÃÇ¿ÉÒԶԽű¾ÓïÑÔ½øÐвÙ×÷£¨±¾Àý½öÊÇÕë¶Ôjavascript
£©
¡¡¡¡1.ÓÃÒýÇæÖ±½Ó½âÎö½Å±¾¹«Ê½
¡¡¡¡Java´úÂë
¡¡¡¡//´´½¨½Å±¾ÒýÇæ¹ÜÀíÆ÷
¡¡¡¡Scri ......