¡¶Îò͸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µÄ±äÁ¿×÷ÓÃÓò
http://www.cnblogs.com/rainman/archive/2009/04/28/1445687.html
ÔÚѧϰJavaScriptµÄ±äÁ¿×÷ÓÃÓò֮ǰ£¬ÎÒÃÇÓ¦µ±Ã÷È·¼¸µã£º
a¡¢JavaScriptµÄ±äÁ¿×÷ÓÃÓòÊÇ»ùÓÚÆäÌØÓеÄ×÷ÓÃÓòÁ´µÄ¡£
b¡¢JavaScriptûÓп鼶×÷ÓÃÓò¡£
c¡¢º¯ÊýÖÐÉùÃ÷µÄ±äÁ¿ÔÚÕû¸öº¯ÊýÖж¼Óж¨Òå¡£
1¡¢JavaScriptµÄ×÷ÓÃÓòÁ´ ......
ÔÚJavascriptÖÐûÓÐclassÀ࣬µ«ÊÇͬÑùÒ²¿ÉÒÔ½øÐжÔÏóµÄ´´½¨¡£ÔÚÃæÏò¶ÔÏóµÄÓïÑÔÖÐÐèҪʵÀý»¯Ä³¸ö¾ßÌåÀàµÄʵÀý£¬ÔÚJavascriptÖÐÔò²»Óá£
ÔÚJavascriptÀ¶ÔÏñ¿ÉÒÔ´´½¨ÐµĶÔÏó£¬Ò²¿ÉÒԼ̳Ð×ÔÆäËû¶ÔÏó¡£Õâ¸ö¸ÅÄî³ÆΪÔÐÍ»¯¼Ì³Ð(prototypal inheritance)¡£
Èκκ¯ÊýÔÚJavascript Öж¼¿ÉÒÔ±»ÊµÀý»¯Ò»¸ö¶ÔÏó¡£
³ÌÐòÈçÏ£º
// ......
<html>
<body>
<script type="text/javascript">
var arr = new Array(3)
arr[0] = "George"
arr[1] = "John"
arr[2] = "Thomas"
var arr2 = new Array(3)
arr2[0] = "James"
arr2[1] = "Adrew"
arr2[2] = "Martin"
document.write(arr.concat(arr2))
</script>
</body>
</ ......
¿ª·¢Ê±£¬ÐèÒªÓõ½µÄJavaScript½ø¶ÈÌõ~~~
<style type="text/css">
#out {
width:200px;
height:16px !important;
border:1px solid #5858D1;
text-align:center;
position:relative;
font-size:12px;
_height:18px;
}
#out, #out * {
padding:0;
margin:0;
}
#num {
height:16px;
line-h ......
¡¶Îò͸JavaScript¡·Ñ§Ï°±Ê¼Ç
ÔÎĵØÖ·£ºhttp://www.cnblogs.com/leadzen/archive/2008/02/25/1073404.html
ÕâÊÇÒ»±¾ºÜÐÎÏóÉú¶¯µÄÊ飬ʹÎÒÃÇ¿ÉÒÔ¸üÉîµØÁ˽âÁËJavaScript¡£
ÒýÑÔ
±à³ÌÊÀ½çÀïÖ»´æÔÚÁ½ÖÖ»ù±¾ÔªËØ£¬Ò»¸öÊÇÊý¾Ý£¬Ò»¸öÊÇ´úÂë¡£±à³ÌÊÀ½ç¾ÍÊÇÔÚÊý¾ÝºÍ´úÂëǧ˿ÍòÂƵ ......