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

¡¶Îò͸javascript¡·Ñ§Ï°±Ê¼Ç£ºÎå¡¢ÆæÃîµÄ¶ÔÏó

ÒýÑÔ
 
ÈκÎÒ»¸öº¯Êý¶¼¿ÉÒÔΪÆ䶯̬µØÌí¼Ó»òÈ¥³ýÊôÐÔ£¬ÕâЩÊôÐÔ¿ÉÒÔÊǼòµ¥ÀàÐÍ£¬¿ÉÒÔÊǶÔÏó£¬Ò²¿ÉÒÔÊÇÆäËûº¯Êý¡£Ò²¾ÍÊÇ˵£¬º¯Êý¾ßÓжÔÏóµÄÈ«²¿ÌØÕ÷£¬ÄãÍêÈ«¿ÉÒ԰Ѻ¯Êýµ±¶ÔÏóÀ´Óá£Æäʵ£¬º¯Êý¾ÍÊǶÔÏó£¬Ö»²»¹ý±ÈÒ»°ãµÄ¶ÔÏó¶àÁËÒ»¸öÀ¨ºÅ“()”²Ù×÷·û£¬Õâ¸ö²Ù×÷·ûÓÃÀ´Ö´Ðк¯ÊýµÄÂß¼­¡£¼´£¬º¯Êý±¾Éí»¹¿ÉÒÔ±»µ÷Óã¬Ò»°ã¶ÔÏóÈ´²»¿ÉÒÔ±»µ÷Ó㬳ý´ËÖ®ÍâÍêÈ«Ïàͬ¡£Çë¿´ÏÂÃæµÄ´úÂ룺
 
¹ØÓÚº¯Êý£¬ÉÏ´úÂë
 
<script language="javascript">
function Sing()
{
   with(arguments.callee)
     alert(author + "£º" + poem);
};
Sing.author = "Àî°×";
Sing.poem = "ºº¼ÒÇصØÔ£¬Á÷Ó°ÕÕÃ÷åú¡£Ò»ÉÏÓñ¹ØµÀ£¬ÌìÑÄÈ¥²»¹é ";
Sing();
Sing.author = "ÀîÕ½";
Sing.poem = "ÈÕ³öºº¼ÒÌ죬ÔÂÂäÒõɽǰ¡£Å®¶ùÅýÅÃÔ¹£¬ÒѳªÈýǧÄê ";
Sing();
</script>
 
£¨ËµÃ÷£º
1.       withµÄÓÃ;ÊÇΪÆ䷶ΧÄÚµÄÊôÐÔÊ¡ÂÔǰ׺£¬Èçarguments.callee.authorºÍarguments.callee.poem¾Í¿ÉÒÔÖ±½Óд³ÉauthorºÍpoem£»
2.       arguments.callee£º±íʾµ±Ç°±»µ÷Óõĺ¯Êý¶ÔÏó£¬Ò²¾ÍÊÇSing,ËùÒÔarguments.callee.author==Sing.author
£©
 
´ÓÉÏÃæµÄ´úÂë¿´À´£¬ÎÒÃÇ¿ÉÒÔ˵£¬º¯ÊýÊÇ¿ÉÒÔ±»Ö±½ÓÖ´ÐеÄÌØÊâ¶ÔÏó£¬Ëü½ö±È¶ÔÏó¶àÁ˶ÔÀ¨ºÅ£¬¶øÆäËüµÄ¶¼Ò»Ñù¡££¨£¿£¿£¿²»ÖªÕâÑù˵ÊDz»ÊÇÍêÈ«ÕýÈ·£©
 
    ºÃÁË£¬ÒÔÉϵĽ²Êö£¬ÎÒÃÇÓ¦¸ÃËãÀí½âÁË function ÀàÐ͵Ķ«Î÷¶¼ÊÇºÍ object ÀàÐÍÒ»ÑùµÄ¶«Î÷£¬ÕâÖÖ¶«Î÷±»ÎÒÃdzÆΪ“¶ÔÏó”¡£
 
¹ØÓÚ¶ÔÏó£¬ÉÏ´úÂë
 
<script language="javascript">
var anObject = {};  //Ò»¸ö¶ÔÏó
anObject.aProperty = "Property of object";  //¶ÔÏóµÄÒ»¸öÊôÐÔ
anObject.aMethod = function(){alert("Method of object")}; //¶ÔÏóµÄÒ»¸ö·½·¨
//Ö÷Òª¿´ÏÂÃ棺
alert(anObject["aProperty"]);   //¿ÉÒÔ½«¶ÔÏóµ±Êý×éÒÔÊôÐÔÃû×÷ΪϱêÀ´·ÃÎÊÊôÐÔ
anObject["aMethod"]();          //¿ÉÒÔ½«¶ÔÏóµ±Êý×éÒÔ·½·¨Ãû×÷ΪϱêÀ´µ÷Ó÷½·¨
for( var s in anObject)           //±éÀú¶ÔÏóµÄËùÓÐÊôÐԺͷ½·¨½øÐеü´ú»¯´¦Àí
alert(s + " i


Ïà¹ØÎĵµ£º

Àí½âJavascript±Õ°ü(closure)

Ò»¡¢Ê²Ã´ÊDZհü£¿
“¹Ù·½”µÄ½âÊÍÊÇ£ºËùν“±Õ°ü”£¬Ö¸µÄÊÇÒ»¸öÓµÓÐÐí¶à±äÁ¿ºÍ°ó¶¨ÁËÕâЩ±äÁ¿µÄ»·¾³µÄ±í´ïʽ£¨Í¨³£ÊÇÒ»¸öº¯Êý£©£¬Òò¶øÕâЩ±äÁ¿Ò²ÊǸñí´ïʽµÄÒ»²¿·Ö¡£
ÏàÐźÜÉÙÓÐÈËÄÜÖ±½Ó¿´¶®Õâ¾ä»°£¬ÒòΪËûÃèÊöµÄ̫ѧÊõ¡£ÎÒÏëÓÃÈçºÎÔÚJavascriptÖд´½¨Ò»¸ö±Õ°üÀ´¸æËßÄãʲôÊDZհü£¬ÒòΪÌø¹ý±Õ°üµÄ´´ ......

javascript &cssʵÏֵij¤ÎÄÕ·ÖÒ³

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>FLYSO Blog-- JS´úÂëʵÏÖµÄ×Ô¶¯·ÖҳЧ¹û~!</TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT=""& ......

JavaScript ´´½¨Êý×éµÄ·½·¨ºÍ»ù±¾²Ù×÷

Êý×éÊÇÎÒ´Óѧϰ±à³ÌÒÔÀ´´ò½»µÀ×î¶àµÄÒ»ÖÖÊý¾ÝÀàÐÍ£¬Æäʵ˵°×ÁË£¬Êý×éÎ޷ǾÍÊÇkey value¶Ô¡£»¹¼ÇµÃ¸Õ²Î¼Ó¹¤×÷Äǻᣬһ¸öphpµÄforeachÑ­»·¾Í²îµã¸ãµÃÎÒÍÂѪ£¬ÏÖÔÚ»ØÍ·ÏëÏ룬µ±Ê±×Ô¼ºÕæ¹»±¿µÄ¡£
Êý×é(array)ÊÇÒ»ÖÖÊý¾ÝÀàÐÍ£¬Ëü°üº¬»òÕß´æ´¢Á˱àÂëµÄÖµ£¬Ã¿¸ö±àÂëµÄÖµ³Æ×÷¸ÃÊý×éµÄÒ»¸öÔªËØ(element),ÿ¸öÔªËصıàÂë±»³Æ×÷Ï ......

10ÖÖJavaScriptÌØЧʵÀýÈÃÄãµÄÍøÕ¾¸üÎüÒýÈË

½ñÌìµÄ»°ÌâÊÇÈçºÎ¸Ä½ø×Ô¼ºÍøÕ¾µÄ½çÃæ»òÌá¸ßÍøÕ¾µÄÊÓ¾õÌåÑ飬´Ó¶øÈÃÓû§¼ÇÒäÓÌС£
¡¡¡¡ÎÒÃÇÓÐÈýÖÖÖ÷ÒªµÄ·½·¨(´ÓÄѵ½Ò×):×Ô¼º¶¯ÊÖд½Å±¾;ʹÓÃÀàËÆÓÚjQueryºÍmooToolsµÄJavaScript¿ò¼Ü(¿ÉÒÔÈñàд´úÂë±ä
µÃ¸üÈÝÒ×Щ);ʹÓÃÄܹ¤×÷ÓÚÏÖÓеÄJavaScript¿ò¼ÜϵÄÌáÇ°Ô¤ÖúõĽű¾»òÄÇÖÖ´ÓÍ·¿ªÊ¼¿ª·¢µÄ´´½¨Õß¡£ÕâƪÎÄÕÂÊʺÏÄÇЩ´òË ......

javascriptÖлñÈ¡Ò»¸ö×Ö·û´®ÖÐ Ìض¨×Ö·û´®µÄ¸öÊý

//ͳ¼Æ×Ö·û´®ÖÐÌض¨×Ö·û´®µÄ¸öÊý
function getStrCount(scrstr,armstr)
{ //scrstr Ô´×Ö·û´® armstr ÌØÊâ×Ö·û
 var count=0;
 while(scrstr.indexOf(armstr) >=1 )
 {
    scrstr = scrstr.replace(armstr,"")
    count++;   
 }
 re ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ