Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB
ÈÈÃűêÇ©£º c c# c++ asp asp.net linux php jsp java vb Python Ruby mysql sql access Sqlite sqlserver delphi javascript Oracle ajax wap mssql html css flash flex dreamweaver xml
 ×îÐÂÎÄÕ : javascript

JavascriptÃæÏò¶ÔÏó±à³Ì£¨Èý£©£º·Çº¯Êý¶ÔÏóµÄ¼Ì³Ð


×òÌ죬ÎÒ±¾À´´òË㣬°ÑÕâ¸ö»°Ìâ½áÊøÁË¡£
µ«ÊÇ£¬Ð´µ½Ò»°ëµÄʱºò£¬ÎÒͻȻÒâʶµ½£¬JavascriptµÄ¼Ì³ÐÓÐÁ½ÖÖ¡£Ò»ÖÖÊÇ»ùÓÚ"º¯Êý¶ÔÏó"µÄ¼Ì³Ð£¬Ò²¾ÍÊÇÒ»¸öfunctionÈ¥¼Ì³ÐÁíÍâÒ»¸öfunction£¬Õâ¸öÎÒÒѾ­ÔÚ×òÌì½éÉܹýÁË¡£
ÁíÒ»ÖÖÔòÊÇ»ùÓÚ"·Çº¯Êý¶ÔÏó"µÄ¼Ì³Ð£¬²»Éæ¼°function¡£ËüµÄ×ö·¨ÓëÇ°Ò»ÖÖÇé¿öÍêÈ«²»Í¬¡£
Ò»¡¢Ê²Ã´ÊÇ"·Çº¯Êý¶ÔÏó"µÄ¼Ì³Ð£¿
±ÈÈ磬ÏÖÔÚÓÐÒ»¸ö¶ÔÏ󣬽Ð×ö"ÖйúÈË"¡£
¡¡¡¡var Chinese = {
¡¡¡¡¡¡¡¡nation:'Öйú'
¡¡¡¡};
»¹ÓÐÒ»¸ö¶ÔÏ󣬽Ð×ö"Ò½Éú"¡£
¡¡¡¡var Doctor ={
¡¡¡¡¡¡¡¡career:'Ò½Éú'
¡¡¡¡}
ÇëÎÊ£¬ÎÒÔõÑù²ÅÄÜÈÃ"Ò½Éú"È¥¼Ì³Ð"ÖйúÈË"£¬Ò²¾ÍÊÇ˵£¬ÎÒÔõÑù²ÅÄÜÉú³ÉÒ»¸ö"ÖйúÒ½Éú"µÄ¶ÔÏó£¿
¶þ¡¢object()·½·¨
json¸ñʽµÄ·¢Ã÷ÈËDouglas Crockford£¬Ìá³öÁËÒ»¸öobject()º¯Êý£¬¿ÉÒÔ×öµ½ÕâÒ»µã¡£
¡¡¡¡function object(o) {
¡¡¡¡¡¡¡¡function F() {}
¡¡¡¡¡¡¡¡F.prototype = o;
¡¡¡¡¡¡¡¡return new F();
¡¡¡¡}
Õâ¸öobject()º¯Êý£¬Æäʵֻ×öÒ»¼þÊ£¬¾ÍÊÇ°Ñ×Ó¶ÔÏóµÄprototypeÊôÐÔ£¬Ö¸Ïò¸¸¶ÔÏ󣬴ӶøʹµÃ×Ó¶ÔÏóÓ븸¶ÔÏóÁ¬ÔÚÒ»Æð¡£
ʹÓõÄʱºò£¬µÚÒ»²½ÏÈÔÚ¸¸¶ÔÏóµÄ»ù´¡ÉÏ£¬Éú³É×Ó¶ÔÏó£º
¡¡¡¡var Doctor = object(Chinese);
È»ºó£¬ÔÙ¼ÓÉÏ×Ó¶ÔÏó±¾ÉíµÄÊôÐÔ£ ......

Javascript ÃæÏò¶ÔÏó±à³Ì£¨Ò»£©£º·â×°


ѧϰJavascript£¬×îÄѵĵط½ÊÇʲô£¿
ÎÒ¾õµÃ£¬Object£¨¶ÔÏó£©×îÄÑ¡£ÒòΪJavascriptµÄObjectÄ£ÐͺܶÀÌØ£¬ºÍÆäËûÓïÑÔ¶¼²»Ò»Ñù£¬³õѧÕß²»ÈÝÒ×ÕÆÎÕ¡£
ÏÂÃæ¾ÍÊÇÎÒµÄѧϰ±Ê¼Ç£¬Ï£Íû¶Ô´ó¼ÒѧϰÕâ¸ö²¿·ÖÓÐËù°ïÖú¡£ÎÒÖ÷Òª²Î¿¼ÁËObject-Oriented JavaScriptºÍProfessional JavaScript for Web Developers (2nd Edition)ÕâÁ½±¾Êé¡£ËüÃǶ¼ÊǷdz£ÓÅÐãµÄJavascript¶ÁÎÍƼöÔĶÁ¡£
±Ê¼Ç·Ö³ÉÁ½²¿·Ö¡£½ñÌìµÄµÚÒ»²¿·ÖÊÇÌÖÂÛ"·â×°"£¨Encapsulation£©£¬ÏÂÒ»´ÎµÄµÚ¶þ²¿·ÖÌÖÂÛ"¼Ì³Ð"£¨Inheritance£©¡£
============================
Javascript ÃæÏò¶ÔÏó±à³Ì£¨Ò»£©£º·â×°
×÷ÕߣºÈîÒ»·å
JavascriptÊÇÒ»ÖÖ»ùÓÚ¶ÔÏó£¨object-based£©µÄÓïÑÔ£¬ÄãÓöµ½µÄËùÓж«Î÷¼¸ºõ¶¼ÊǶÔÏó¡£µ«ÊÇ£¬ËüÓÖ²»ÊÇÒ»ÖÖÕæÕýµÄÃæÏò¶ÔÏó±à³Ì£¨OOP£©ÓïÑÔ£¬ÒòΪËüµÄÓï·¨ÖÐûÓÐclass£¨Àࣩ¡£
ÄÇô£¬Èç¹ûÎÒÃÇÒª°Ñ"ÊôÐÔ"£¨property£©ºÍ"·½·¨"£¨method£©£¬·â×°³ÉÒ»¸ö¶ÔÏó£¬ÉõÖÁÒª´ÓÔ­ÐͶÔÏóÉú³ÉÒ»¸öʵÀý¶ÔÏó£¬ÎÒÃÇÓ¦¸ÃÔõô×öÄØ£¿
1. Éú³É¶ÔÏóµÄԭʼģʽ
¼Ù¶¨ÎÒÃÇ°Ñè¿´³ÉÒ»¸ö¶ÔÏó£¬ËüÓÐ"Ãû×Ö"ºÍ"ÑÕÉ«"Á½¸öÊôÐÔ¡£
¡¡¡¡var Cat = {
¡¡¡¡¡¡¡¡name : '',
¡¡¡¡¡¡¡¡color : ''
¡¡¡¡}
ÏÖÔÚ£¬ÎÒÃÇÐèÒª¸ù¾ÝÕâ¸öÔ­ÐͶÔÏó£¬Éú³ÉÁ ......

JavaScript ¹æ·¶±àд

×î½ü±àдJavascript´úÂë¡£Æð³õû¹ÜÄÇô¶à¡£Ò»Õó¿ñд¡£´úÂëдµÃ²î²»¶àÁË¡£½á¹ûÉÏ°ÙKÎļþ¼¸Ê®¸ö¡£µ±È» û°ì·¨ÐèҪѹËõÁË¡£ÎªÁËËٶȡ£
ÕÒѹËõ¹¤¾ß¡£ÅªÁËÏ¡£½á¹û´íÎóÒ»´ó¶Ñ¡£×îºó²Å·¢ÏÖÊÇ×Ô¼ºÐ´µÄ´úÂë²»¹æ·¶µ¼Öµġ£¼ì²éÁË°ëÌìÐÞÕýÁ˼¸Ê®¸öµØ·½¡£ÖÕÓÚÄÜѹËõÁË¡£
ÏÂÃæ×ܽáÏÂÐèҪעÒâµÄµØ·½
1¡¢¶ÔÏó½áβ function½áβ ×îºÃÒª¼Ó ";"ºÅ
Èç
 var a={
 .....
};
2¡¢Êý×é½áβҪ¼Ó ";" ºÅ¡£
È磺
 var b=[...];
3¡¢º¯Êý½áβҪ¼Ó ";" ºÅ¡£
È磺
  func1();
4¡¢»¨À¨ºÅÄÚ ×îºóÒ»¸öÓï¾ä¿ÉÒÔ²»¼Ó ";" ºÅ¡£
5¡¢ifÓï¾äµÄ·ÖÖ§ ×îºÃ¶¼Óà "{"¡¢"}"À¨ÆðÀ´¡£ ......

phpÖеÄevalºÍJavaScriptÖеÄeval

phpÖеÄevalºÍJavaScriptÖеÄevalÇø±ð£º
Definition and Usage

¶¨ÒåºÍÓ÷¨
The eval() function evaluates a
string as PHP code.
eval()º¯ÊýµÄ×÷ÓÃÊÇ£º·µ»ØÓëPHP´úÂëÏà¶ÔÓ¦µÄ×Ö·û´®¡£
The string
must be valid PHP code and must end with semicolon.
Õâ¸ö×Ö·û´®±ØÐëÊÇÓÐЧµÄPHP´úÂ룬
²¢ÇÒ±ØÐëÒԷֺŽáÊø¡£
This function returns NULL unless a return statement is
called in the code string. Then the value passed to return is returned.
If there is a parse error in the code string, eval() returns FALSE.
³ý
ÁËÔÚ´úÂë×Ö·û´®ÖÐÇëÇó“·µ»ØÓï¾ä[return
statement]”µÄÇé¿ö£¬ÔÚÆäËüÇé¿öÏ£¬Õâ¸öº¯Êý¶¼½«·µ»Ø¿ÕÖµ[NULL]£»Èç¹ûÇëÇóÁË“·µ»ØÓï¾ä”£¬ÄÇôËü½«·µ»Ø±»´«µÝµ½“·µ»ØÓï¾ä”ÖеÄÖµ¡£Èç
¹ûÕâ¶Î´úÂë×Ö·û´®³öÏÖ´íÎó£¬eval()º¯Êý½«·µ»ØFalse¡£
eval()º¯Êý£¬Õâ¸öº¯Êý¿ÉÒÔ°ÑÒ»¸ö×Ö·û´®µ±×÷Ò»¸öJavaScript±í´ïʽһÑùÈ¥Ö´ÐÐËü¡£
¿ÉÒÔ½«×Ö·û´®µÄÐÎʽת»»³ÉÊýÖµÐ͵È
ob_start() ob_end_clean() ob_get_contents()
(2008-12-19 16:17:41)
תÔØ

±êÇ©£º
»º³åÇø
start
±äÁ¿
work
ob_sta ......

phpÖеÄevalºÍJavaScriptÖеÄeval

phpÖеÄevalºÍJavaScriptÖеÄevalÇø±ð£º
Definition and Usage

¶¨ÒåºÍÓ÷¨
The eval() function evaluates a
string as PHP code.
eval()º¯ÊýµÄ×÷ÓÃÊÇ£º·µ»ØÓëPHP´úÂëÏà¶ÔÓ¦µÄ×Ö·û´®¡£
The string
must be valid PHP code and must end with semicolon.
Õâ¸ö×Ö·û´®±ØÐëÊÇÓÐЧµÄPHP´úÂ룬
²¢ÇÒ±ØÐëÒԷֺŽáÊø¡£
This function returns NULL unless a return statement is
called in the code string. Then the value passed to return is returned.
If there is a parse error in the code string, eval() returns FALSE.
³ý
ÁËÔÚ´úÂë×Ö·û´®ÖÐÇëÇó“·µ»ØÓï¾ä[return
statement]”µÄÇé¿ö£¬ÔÚÆäËüÇé¿öÏ£¬Õâ¸öº¯Êý¶¼½«·µ»Ø¿ÕÖµ[NULL]£»Èç¹ûÇëÇóÁË“·µ»ØÓï¾ä”£¬ÄÇôËü½«·µ»Ø±»´«µÝµ½“·µ»ØÓï¾ä”ÖеÄÖµ¡£Èç
¹ûÕâ¶Î´úÂë×Ö·û´®³öÏÖ´íÎó£¬eval()º¯Êý½«·µ»ØFalse¡£
eval()º¯Êý£¬Õâ¸öº¯Êý¿ÉÒÔ°ÑÒ»¸ö×Ö·û´®µ±×÷Ò»¸öJavaScript±í´ïʽһÑùÈ¥Ö´ÐÐËü¡£
¿ÉÒÔ½«×Ö·û´®µÄÐÎʽת»»³ÉÊýÖµÐ͵È
ob_start() ob_end_clean() ob_get_contents()
(2008-12-19 16:17:41)
תÔØ

±êÇ©£º
»º³åÇø
start
±äÁ¿
work
ob_sta ......

Èç¹ûÔÚCHtmlDialogÖе÷ÓÃJavascriptº¯Êý

// µ÷ÓÃÒ³ÃæµÄˢз½·¨
     IHTMLWindow2* pWindow;
     IHTMLDocument2*   pDocument; 
     HRESULT hr = GetDHtmlDocument(&pDocument);  
     hr = pDocument->get_parentWindow(&pWindow);  
     if( pWindow)
     {
      VARIANT ret;  
      ret.vt = VT_EMPTY;
      CString sFunc = _T("RefreshFileForClient()");
      CString sLang = _T("javascript");
      hr = pWindow->execScript(sFunc.AllocSysString(), sLang.AllocSysString(), &ret);
     } ......

JavaScript:history.go() µÄÃîÓÃ(ת)

  ÔÚWeb¿ª·¢ÖУ¬»áÓöµ½´ÓÒ»Ò³£¨¸¸Ò³£©µ¼ÏòÁíÒ»Ò³£¨×ÓÒ³£©£¬²¢ÇÒÒªÇó“·µ»Ø”¸¸Ò³µÄÇé¿ö£¬ÔÚÕâÀïÈç¹ûÓÃASP.NETÌṩµÄ Response.Redirect()·½·¨£¬ÍùÍù²»»á´ïµ½ÀíÏëµÄЧ¹û£¬ÀýÈ磺·µ»Øºó£¬ÖØмÓÔØÁËÒ³Ã棬ÎÞ·¨±£´æµ¼Ïò×ÓҳǰµÄ״̬£¬µÈµÈ£¬ÔÚÕâÀïÎҾͽéÉÜ Ò»ÏÂÈçºÎʹÓÃJavaScriptÖÐhistory.go()º¯ÊýÀ´ÊµÏÖ·µ»Ø¹¦Äܲ¢ÇÒ±£´æס״̬µÄ·½·¨¡£
     Õâ¸öº¯ÊýÓÃÆðÀ´ºÜ¼òµ¥£¬Ö»ÒªÔÚÒ³ÃæÉϼÓÒ»¸öhtmlµÄinputÔªËØ£¬ÀýÈ磺
     <input type="button" value="·µ»Ø">
     È»ºóÔÙΪÕâ¸öÔªËØÌí¼ÓonclickÊôÐÔ£¬È磺
     <input type="button" value="·µ»Ø" onclick="history.go(-1);">
     ÕâÑù¾ÍÄÜ´ïµ½·µ»ØÉÏÒ»Ò³µÄЧ¹û¡£µ«ÊÇ£¬ÍùÍùÔÚʵ¼ùÖУ¬²¢Ã»ÓÐÕâô¼òµ¥£¬µ±ÄãÔÚÏò·þÎñÆ÷Ìá½»ÇëÇóµÄʱºò£¬ÒýÆðÒ³Ãæ»Ø·¢£¬ÄãÔÙÓÃhistory.go(-1) ÕâÕоͲ»ÁéÀ²£¬ËüÔÚÕâÀïÊÇ·µ»ØÄã»Ø·¢Ç°µÄ״̬£¬goºóÃæµÄ²ÎÊý£¬Êµ¼ÊÉϾÍÊDZêʶÄãÒª·µ»ØÄã»Ø·¢µÚÇ°n´ÎµÄ״̬£¬ËùÒÔÖ»ÒªÄܼÇס»Ø·¢Á˼¸´Î£¬¾ÍÄÜÓà history.go(-n)׼ȷµØ·µ»Øµ½¸¸Ò³ÁË¡£
     Ô ......
×ܼǼÊý:2244; ×ÜÒ³Êý:374; ÿҳ6 Ìõ; Ê×Ò³ ÉÏÒ»Ò³ [10] [11] [12] [13] 14 [15] [16] [17] [18] [19]  ÏÂÒ»Ò³ βҳ
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ