[¶ÁÊé±Ê¼Ç][JavaScript¸ß¼¶³ÌÐòÉè¼Æ]
µÚ¶þÕ£ºECMAScript»ù´¡
1.µ±º¯ÊýÎÞÃ÷È··µ»Øֵʱ£¬·µ»ØµÄÒ²ÊÇÖµundefined
function testFunc(){}
alert(testFunc()==undefined);
2.typeof(null)=='object' //true,null¿ÉÒÔ½âÊÍΪ¶ÔÏóռλ·û
3.undefined ÊÇÉùÃ÷Á˱äÁ¿µ«Î´¶ÔÆä³õʼ»¯Ê±¸³Óè¸Ã±äÁ¿µÄÖµ£¬nullÔòÓÃÓÚ±íʾÉÐδ´æÔڵĶÔÏó¡£
alert(null==undefined);//true£¬ÒòΪundefinedÊÇ´ÓÖµnullÅÉÉúÀ´µÄ
4.var num=3.12e3//3.12*10*10*10
var num=3.12-e3//0.00312
5.¹ØÓÚjs±Õ°ü£¬¼òµ¥½âÊÍÊǺ¯Êýµ÷Óú¯ÊýÒÔÍâ±äÁ¿µÄÏÖÏó¡£
var baseNum = 10;
function addNumber(num1,num2){
function doAddition(){
return num1+num2+baseNum;//ÕâÀïµÄnum1¡¢num2¡¢baseNum±äÁ¿¶¼ÊÇ´Óº¯ÊýdoAdditionÍⲿ»ñÈ¡µÄ¡£
}
return doAddition();
}
µÚÈýÕ£º¶ÔÏó»ù´¡
1.ECMA°Ñ¶ÔÏó(object)¶¨ÒåΪ“ÊôÐÔµÄÎÞÐò¼¯ºÏ£¬Ã¿¸öÊôÐÔ´æ·ÅÒ»¸öÔʼֵ¡¢¶ÔÏó»òº¯Êý”£¬»òÕß˵¶ÔÏóÊÇÎÞÌض¨Ë³ÐòµÄÖµµÄÊý×é¡£
2.¶ÔÏó¶¨Òå´æ·ÅÔÚ¹¹Ô캯ÊýÖС£
3.¶ÔÏóµÄ¹¹³É
¶ÔÏóÓÉÌØÐÔ(attribute)¹¹³É£¬ÌØÐÔ¿ÉÒÔÊÇÔʼֵ£¬Ò²¿ÉÒÔÊÇÒýÓÃÖµ¡£Èç¹ûÌØÐÔ´æ·ÅµÄÊǺ¯Êý£¬ÔòËü½«±»¿´×÷ÊǶÔÏóµÄ·½·¨(method)£¬·ñÔò¸ÃÌØÐÔ±»¿´×÷ÊôÐÔ(propert).
4.¶ÔÏóµÄ·Ï³ý
var obj={};
obj=null
×¢£º±ØÐ뽫ËùÓжÔÏóÒýÓÃÈ«²¿¸³ÖµÎªnull£¬²ÅÄÜÕæÕý½«¸Ã¶ÔÏó·Ï³ý¡£
5.Array¶ÔÏó³£Ó÷½·¨
var arr=[1,2,'string'];
·½·¨Ãû
²ÎÊý
·µ»ØÖµ
¹¦ÄÜ
concat
4,'hello'
[1,2,'string',4,'hello']
½«4¡¢'hello'¼ÓÈëÊý×é
slice
1,3
[2,3]
·µ»ØµÚ2ÏîÖÁµÚ4ÏîµÄÐÂÊý×飬²»°üÀ¨µÚ4ÏîÊý×é
push
{num:1}
[1,2,'string',{num:1}]
ѹÈëÐÂÏÔÊý×鳤¶È¼Ó1
pop
arr[length-1]
µ¯³ö×îÐÂÏÔÊý×鳤¶È¼õ1
shift
arr[0]
ɾ³ýÊý×éµÚÒ»Ï½«Æä×÷Ϊº¯ÊýÖµ
·µ»Ø
unshift
'black'
['black',1,2,'string']
½«blackÉèΪÊý×éµÚÒ»ÏÆäËûÏîÏòºóÒÆһλ
slice·½·¨£º
6.
Ïà¹ØÎĵµ£º
Ò³ÃæÌá½»Êý¾ÝÒ»°ãÓÐÁ½ÖÖ·½·¨£ºget,post¡£post¾ÍÊÇËùνµÄformÌá½»£¬Ê¹ÓÃÊÓͼ£»getÊÇͨ¹ýurlÌá½»¡£
Get·½·¨Ò»°ãÓúǫ́´úÂ루Èçasp,asp.net£©»ñµÃ²ÎÊý£¬´úÂëºÜ¼òµ¥£ºRequest.QueryString["id"];¼´¿É»ñÈ¡¡£
ÓÐЩʱºòÐèÒªÖ±½ÓÔÚǰ̨»ñÈ¡url²ÎÊý£¬ÒªÓõ½javascript£¬jsûÓÐÖ±½Ó»ñÈ¡url²ÎÊýµÄ·½·¨£¬ÄÇô£¬ÎÒÃÇÈçºÎͨ¹ýjs ......
ÓÉÓÚ×î½ü×Ô¼ºµÄFireFox¾³£³öÏÖµ÷ÓÃJS½Å±¾Ê±Ôì³ÉÄÚ´æÒç³ö¶ø²úÉú¼ÙËÀµÄÏÖÏ󣬽ñÌì¸ÕºÃÓÐÐÒ¿´µÄIBMÍøÕ¾ÀïÕâƪÎÄÕ£¬¶ø×Ô¼ºÏÖÔÚÓÖÔÚѧϰJS£¬¿´ÁËÒÔºó¾õµÃдµÄ·Ç³£²»´í£¬Ìáµ½Á˺ܶàÎÒÃÇƽʱÔÚ±àдJS´úÂëʱÈÝÒ×Ôì³ÉµÄ´íÎó¡£ÏÖ½«´ËÎÄ·ÖÏí¸ø´ó¼Ò£¡
Internet Explorer ºÍ Mozilla Firefox ÊÇÁ½¸öÓë JavaScript ÖеÄÄÚ´æй©ÁªÏµ×îÎ ......
Ò³ÃæÒ»£º
<html>
<head>
<title> ÑéÖ¤ÓëÌá½»Ò» </title>
<script>
function focusSelect(ID) //µ±ÑéÖ¤²»ÄÜͨ¹ýʱ»ñµÃÑéÖ¤¿Ø¼þµÄ½¹µãºÍÄÚÈÝ
{
document.getElementById(I ......
×òÌ죬ÎÒ±¾À´´òË㣬°ÑÕâ¸ö»°Ìâ½áÊøÁË¡£
µ«ÊÇ£¬Ð´µ½Ò»°ëµÄʱºò£¬ÎÒͻȻÒâʶµ½£¬JavascriptµÄ¼Ì³ÐÓÐÁ½ÖÖ¡£Ò»ÖÖÊÇ»ùÓÚ"º¯Êý¶ÔÏó"µÄ¼Ì³Ð£¬Ò²¾ÍÊÇÒ»¸öfunctionÈ¥¼Ì³ÐÁíÍâÒ»¸öfunction£¬Õâ¸öÎÒÒѾÔÚ×òÌì½éÉܹýÁË¡£
ÁíÒ»ÖÖÔòÊÇ»ùÓÚ"·Çº¯Êý¶ÔÏó"µÄ¼Ì³Ð£¬²»Éæ¼°function¡£ËüµÄ×ö·¨ÓëÇ°Ò»ÖÖÇé¿öÍêÈ«²»Í¬¡£
Ò»¡¢Ê²Ã´ÊÇ"·Çº¯Êý¶ÔÏ ......
**
* ÎÒÔÚÍøÉÏ¿´µ½¹ýºÜ¶àBASE64µÄJavaScriptËã·¨£¬¶¼¾õµÃ²»ÂúÒ⣬ÓÚÊÇ×Ô¼ºÐ´ÁËÒ»¸ö£¬ÔÚÕâÀï·ÖÏíһϡ£
* ÎҵĴúÂëÔÚÖÊÁ¿µÄЧÂʶ¼½Ï¸ß£¬Ã»ÓÐһЩÈßÓàµÄ²Ù×÷¡£×ÜÌåÀ´½²ÎÒ¾õµÃ·Ç³£²»´í¡£
* Èç¹û´ó¼ÒÓÐʲô²»¶®µÄµØ·½¿ÉÒÔÎÊÎÒ¡£
*/
var BASE64={
/**
* ´Ë±äÁ¿Îª±àÂëµÄ ......