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

Javascript±Õ°ü(Closure)

ClosureÖÐÎÄ·­ÒëΪ±Õ°ü.×ÖÃæÉÏÀ´Àí½â¾ÍÊÇ"·â±ÕµÄ°ü".(ÕâÊÇÒ»¾ä·Ï»°)
±Õ°üÊÇʲô?
ÊéÃæ½âÊÍΪ:
Ëùν“±Õ°ü”£¬Ö¸µÄÊÇÒ»¸öÓµÓÐÐí¶à±äÁ¿ºÍ°ó¶¨ÁËÕâЩ±äÁ¿µÄ»·¾³µÄ±í´ïʽ£¨Í¨³£ÊÇÒ»¸öº¯Êý£©£¬Òò¶øÕâЩ±äÁ¿Ò²ÊǸñí´ïʽµÄÒ»²¿·Ö¡£
ÎÒÈÏΪ±Õ°ü¾ÍÊÇÄܹ»¶Á/дº¯ÊýÄÚ²¿µÄijЩ±äÁ¿µÄ×Óº¯Êý,²¢½«ÕâЩ±äÁ¿±£´æÔÚÄÚ´æÖÐ.
±Õ°üµÄ×÷ÓÃ
ÉÏÃæµÄ¸ÅÄîÖÐÒѾ­Ìáµ½¹ý,Ö÷Òª¾ÍÊÇΪÁ˶Á/
дº¯ÊýÄÚ²¿µÄijЩ±äÁ¿,²¢½«Ëü±£³ÖÔÚÄÚ´æÖÐ.¿ÉÄÜÕâÑù½²Î´±ØÕâôÈÝÒ×Àí½â,ÏÂÃæÈÃÎÒÃÇÀ´¿´Ò»Ð©Àý×Ó:
1,¶ÁÈ¡¾¯²ìµÄÉúÃüÖµ
function PoliceMan() {
//¶¨Òå³õʼÉúÃüÖµ
var lifeEnergy = 100;
//ÏÔʾµ±Ç°ÉúÃüÖµ
function showLifeEnergy() {
alert(lifeEnergy);
}
return showLifeEnergy;
}
//´´½¨Ò»¸ö¾¯²ì
var pm = new PoliceMan();
//ÏÔʾµ±Ç°ÉúÃüÖµ
pm();

2,¶Áд/±£´æ ¾¯²ìµÄÉúÃüÖµ
function PoliceMan() {
//¶¨Òå³õʼÉúÃüÖµ
var lifeEnergy = 100;
//Öе¯¼õÉÙÉúÃüÖµ
InBullet = function(){
lifeEnergy -= 1;
}
//ÏÔʾµ±Ç°ÉúÃüÖµ
function showLifeEnergy() {
alert(lifeEnergy);
}
return showLifeEnergy;
}
//´´½¨Ò»¸ö¾¯²ì
var pm = new PoliceMan();
//ÏÔʾµ±Ç°ÉúÃüÖµ
pm();
//Öе¯¼õÉÙÉúÃüÖµ
InBullet();
//ÏÔʾµ±Ç°ÉúÃüÖµ
pm();

×¢ÒâÊÂÏî
ÓÉÒÔÉÏÀý×ÓÎÒÃÇ¿ÉÒÔ¿´µ½¾¯²ìµÄÉúÃüÖµ±äÁ¿
lifeEnergy»áһֱפÁôÔÚÄÚ´æµ±ÖÐ.Èç¹ûÕâÖÖ·½·¨Ê¹ÓÃÆµ·±,ÄÇôºÜÈÝÒ׾ͰѻúÆ÷µÄÄÚ´æÏûºÄÍê.Òò´Ë½¨ÒéÄÜÓú¯ÊýµÄµØ·½¾Í¾¡Á¿Ê¹Óú¯Êý,¶ø²»ÒªÊ¹ÓÃ
±Õ°ü.
×÷Õߣº·ÊÕ¼
³ö´¦£ºhttp://extjs.org.cn

±¾ÎİæÈ¨¹é×÷ÕߺÍExtJsÖÐÎÄ×ÊѶվ¹²ÓУ¬»¶Ó­×ªÔØ£¬µ«Î´¾­×÷ÕßͬÒâ±ØÐë±£Áô´Ë¶ÎÉùÃ÷£¬ÇÒÔÚÎÄÕÂÒ³ÃæÃ÷ÏÔλÖøø³öÔ­ÎÄÁ¬½Ó¡£


Ïà¹ØÎĵµ£º

ͨ¹ýjavascript»ñµÃurl²ÎÊý

Ò³ÃæÌá½»Êý¾ÝÒ»°ãÓÐÁ½ÖÖ·½·¨£ºget,post¡£post¾ÍÊÇËùνµÄformÌá½»£¬Ê¹ÓÃÊÓͼ£»getÊÇͨ¹ýurlÌá½»¡£
Get·½·¨Ò»°ãÓúǫ́´úÂ루Èçasp,asp.net£©»ñµÃ²ÎÊý£¬´úÂëºÜ¼òµ¥£ºRequest.QueryString["id"];¼´¿É»ñÈ¡¡£ 
ÓÐЩʱºòÐèÒªÖ±½ÓÔÚǰ̨»ñÈ¡url²ÎÊý£¬ÒªÓõ½javascript£¬jsûÓÐÖ±½Ó»ñÈ¡url²ÎÊýµÄ·½·¨£¬ÄÇô£¬ÎÒÃÇÈçºÎͨ¹ýjs ......

[¶ÁÊé±Ê¼Ç][JavaScript¸ß¼¶³ÌÐòÉè¼Æ]

µÚ¶þÕ£ºECMAScript»ù´¡
1.µ±º¯ÊýÎÞÃ÷È··µ»ØÖµÊ±£¬·µ»ØµÄÒ²ÊÇÖµundefined
  function testFunc(){}
  alert(testFunc()==undefined);
2.typeof(null)=='object' //true,null¿ÉÒÔ½âÊÍΪ¶ÔÏóռλ·û
3.undefined ÊÇÉùÃ÷Á˱äÁ¿µ«Î´¶ÔÆä³õʼ»¯Ê±¸³Óè¸Ã±äÁ¿µÄÖµ£¬nullÔòÓÃÓÚ±íʾÉÐδ´æÔڵĶÔÏó¡£
  alert(nu ......

javascript location.reload()

¹¦ÄÜ£º
ÖØÐ¼ÓÔØÎĵµ¡£
Óï·¨£º
location.reload(force)
²ÎÊý£º
force£º¿ÉÑ¡²ÎÊý£¬ÊÇÒ»¸ö²¼¶ûÖµ¡£
      Èç¹ûÊ¡ÂÔ²ÎÊý£¬»òÕß²ÎÊýÊÇfalse£¬Ëü¾Í»áÓÃHTTPÍ·If-Modified-SinceÀ´¼ì²â·þÎñÆ÷ÉϵÄÎĵµÊÇ·ñÒѸı䡣Èç¹ûÎĵµÒѸÄ
±ä£¬reload()»áÔÙ´ÎÏÂÔØ¸ÃÎĵµ¡£Èç¹ûÎĵµÎ´¸Ä±ä£¬Ôò¸Ã·½·¨½«´Ó»º´æÖÐ ......

ʹÓÃJavaScriptÁ¬½ÓSqlServerÊý¾Ý¿â¡£Ö´ÐÐCRUD²Ù×÷¡£

function db()
{
//»î¶¯±àºÅ
var activeid = Request.Form("activeid");
//Óû§Ãû
var username = Request.Form("username");
//ÊÖ»úºÅÂë
var mobile = Request.Form("mobile");
var conn= Server.CreateObject("ADODB.connection");
var rs= Serve ......

javaScript¹Ø±Õä¯ÀÀÆ÷ (²»µ¯³öÌáʾ¿ò)

£¼script language="javaScript"£¾
function closeWindow()
{
¡¡window.opener = null;
¡¡window.open(' ', '_self', ' ');
¡¡window.close();
}
£¼/script£¾
£¼input type='button' value='¹Ø±Õ´°¿Ú' onClick="closeWindow()"£¾
»ò
£¼input type="button" value="¹ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ