資源描述:
《javascript常用函數(shù)集(常規(guī)函數(shù)、數(shù)組函數(shù)、日期函數(shù)、數(shù)學(xué)函數(shù)、字符串函數(shù))》由會員上傳分享,免費在線閱讀,更多相關(guān)內(nèi)容在工程資料-天天文庫。
1、javascript常用函數(shù)集(常規(guī)函數(shù).數(shù)組函數(shù)、日期函數(shù)、數(shù)學(xué)函數(shù)、字符串函數(shù))JavaScriptprovidesmanyfunctionsfordeveloperstouse,andhereisabriefintroduction,moredetailedinformation,refertotheonlinehelpprovidedbyVisualIntcrDcv.JavaScriptfunctionscanbedividedintofivecategories:conventionalfunctions,arrayfunctions,datefunct
2、ions,mathematicalfunctions,stringfunctions?1,regularfunctionTheJavaScriptroutinefunctionconsistsofthefollowing9functions:(1)alertfunction:displaysawarningdialogbox,includingaOKbutton.(2)confirmfunction:displaysaconfirmationdialog,includingtheOKandCancelbuttons?(3)escapefunction:conver
3、tscharactersintoUnicodccodes?(4)Evalfunction:calculatingtheresultofanexpression.(5)isNaNfunction:thetestis(true),no(false)isnotanumber?(6)parseFloatfunction:convertsstringsintocharacternumbers?(1)parselntfunction:convertsstringsintointegernumbers(whichcanbespecifiedinhexadecimalnumber
4、s)?(2)promptfunction:displaysaninputdialogboxthatpromptsforuserinput?Suchas:Script>(3)theunescapefunctiondecodesthecharactersencodedbytheescapefunction.1,arrayfunctionTheJavaScript
5、arrayfunctionconsistsofthefollowing4functions:(1)joinfunction:convertandcormectallelementsinanarraytoastring.Cases:Function,JoinDemo()VaR,a,b;A二new,Array(0,1,2,3,4);B=a?join(〃-“);//delimiterReturn(b);//returnb=0-1-2-3-4〃}Cases:(1)lengthfunction:returnsthelengthofthearray.Function,Leng
6、thDemo(){VaR,a,1;A二new,Array(0,1,2,3,4):L二a?length;Return(L);//1=5(2)reversefunction:invertthearrayelementsinreverseorder?Cases:Function,ReverseDemo(){VaR,a,1;A二new,Array(0,1,2,3,4);L=a?reverse();Return(L);}(1)sortfunction:reorderthearrayelements?Cases:Function,SortDemo(){VaR,a,1;A二ne
7、w,Array(〃X〃,〃Y〃,〃d〃,,〃廠,〃nT,〃R〃);L=a.sort();Return(L);1,datefunctionTheJavaScriptdatefunctionconsistsofthefollowing20functions:(1)getDatefunction:thedatevalueofthereturndate,whichis1'31.Cases:Function,DateDemo(){VaR,D,s二"Today's,date,is:〃〃;D二new,Date();S二(d.getMonth)(+1)+〃/〃;S二d.getDa
8、te(+)