dz̸JavaScriptµÄArray¶ÔÏó
Array×÷ΪJavaScriptµÄÒ»¸öÄÚÖöÔÏó£¬ÓÐ×ÅÇ¿´óµÄ¹¦ÄÜ£»Ïà¶ÔÓÚÆäËûÄÚÖöÔÏóÀ´Ëµ£¬ËûÓÐ×ÅÌØÊâµÄÓ÷¨£¬ÏÂÃæ¶Ô˵˵×Ô¼º¶ÔArrayµÄÓ÷¨µÄÒ»¸öС×ܽ᣺
1>ÓÃ;һ£ºÊý×é
Êý×é×î´ó´æ´¢Êý¾ÝΪËÄÊ®¶àÒÚ¸ö£¬Õâ¸ö¿Õ¼ä×ã¹»ÓÃÁË£¬ËùÒÔÊý×é¿ÉÒÔËæ±ãµÄÀ©ÈÝ¡£ÏÂÃæ¶Ô³£Óõķ½·¨½øÐÐ×ܽᣬÈçÏ£º
<!--´´½¨Êý×éµÄ·½Ê½-->
var array1 = new Array;
var array2 = new Array(2);
var array3 = new Array("green","red","blue");
var array4 = ["one","two","three"];
<!--¶ÔÊý×éµÄ²Ù×÷,ÌáʾËùÓвÙ×÷ÊǶÔÔarrayµÄ²Ù×÷-->
array3.length // 3
array3.toString() // green,red,blue
array3.valueOf() // green,red,blue
array3.join() // green,red,blue
array3.join("") // green red blue
array3.join("-") // green-red-blue
array3.shift() // red,blue
array3.unshift("black") // black,green,red,blue
<!--Êý×é×îÓÐ×Ô¶¯À©ÈݵŦÄÜ-->
array2.length // 2
array2[28] = "aa"; array2.length // 29
array2.shift(); array2.length //1
<!--×Ö·û´®ÓëÊý×é¼äµÄת»»-->
var str = "green"
var arr = str.split("");
arr.toString() // "g,r,e,e,n"
2>ÓÃ;¶þ£ºÕ»
Êý×éÔÚÓеÄʱºò»¹¿ÉÒÔµ±×÷Õ»À´Ê¹Ó㬴´½¨·½Ê½¸úÊý×éÀàËÆ£º
var arr = new Array;
arr.push("1");
arr.push("2");
arr.push("3");
arr.push("4");
for(var i=0;i<arr.length;i++){
alert(arr.pop());
}
//output: 4 3 2 1
Ïà¹ØÎĵµ£º
1.document.formName.item("itemName") ÎÊÌâ
˵ Ã÷:IEÏÂ,¿ÉÒÔʹÓÃdocument.formName.item("itemName")»òdocument.formName.elements ["elementName"];FirefoxÏÂ,Ö»ÄÜʹÓÃdocument.formName.elements["elementName"].
½â¾ö·½·¨:ͳһʹÓÃdocument.formName.elements["elementName"].
2.¼¯ºÏÀà¶ÔÏóÎÊÌâ
˵Ã÷:IEÏÂ,¿ÉÒÔ ......
1ÅжÏselectÑ¡ÏîÖÐ ÊÇ·ñ´æÔÚValue="paraValue"µÄItem
2ÏòselectÑ¡ÏîÖÐ ¼ÓÈëÒ»¸öItem
3´ÓselectÑ¡ÏîÖРɾ³ýÒ»¸öItem
4ɾ³ýselectÖÐÑ¡ÖеÄÏî
5ÐÞ¸ÄselectÑ¡ÏîÖÐ value="paraValue"µÄtextΪ"paraText"
6ÉèÖÃselectÖÐtext="paraText"µÄµ ......
CSS¸´ºÏЧ¹û
CSSµÄЧ¹ûÊÇ¿ÉÒÔÖصþµÄ£¬ÀýÈçclass="a b"£¬ÄÇôÕâ¸ö½Úµã¾ÍͬʱӵÓÐÁËaºÍbµÄÊôÐÔ£¬²¢ÇÒ£¬b¿ÉÒÔ¸²¸ÇaµÄÊôÐÔ¡£
JavaScriptÔÚHtmlÖеÄÖ´ÐÐ˳Ðò
¾¹ý¼òµ¥²âÊÔ£¬·¢ÏÖJavaScriptµÄÖ´ÐÐ˳ÐòÊÇ°´ÕÕjsµÄ¼ÓÔØ˳Ðò½øÐеģ¬¶øonloadº¯ÊýÊÇÔÚÕû¸öÒ³Ãæ¼ÓÔØÍê³Éºó²Å¿ªÊ¼Ö´ÐС£
ÎҵIJâÊÔÎļþ£º
<!--
To change this ......
(Ò»)¶ÔÏóð³ä
function A(name){
this.name = name;
this.sayHello = function(){alert(this.name+” say Hello!”);};
}
function B(name,id){
this.temp = A;
this.temp(name); &nbs ......