JS內(nèi)置對(duì)象屬性及方法大全_第1頁(yè)
JS內(nèi)置對(duì)象屬性及方法大全_第2頁(yè)
已閱讀5頁(yè),還剩2頁(yè)未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、學(xué)習(xí)好資料歡迎下載getTime()返回從1970年1月1號(hào) 0:0:0 到現(xiàn)在一共花去的毫秒數(shù)getTimezoneoffset()返回時(shí)區(qū)偏差值,即格林威治平均時(shí)間(GMT)與運(yùn)行腳本的計(jì)算機(jī)所處時(shí)區(qū)設(shè)置之間相差的分鐘數(shù))返回在 Date 字符串中自從 1970 年 設(shè)置年份.2 位數(shù)或 4 位數(shù) 設(shè)置年份.4 位數(shù)設(shè)置月份(0-11) 設(shè)置日(1-31) 設(shè)置小時(shí)數(shù) (0-23) 設(shè) 置 分 鐘 數(shù) (0-59) 設(shè) 置 秒 數(shù)(0-59)設(shè)置毫秒(0-999)依據(jù)國(guó)際時(shí)間來(lái)設(shè)置年份 依據(jù)國(guó)際時(shí)間來(lái)設(shè)置月(0-11)依據(jù)國(guó)際時(shí)間來(lái)設(shè)置日(1-31) 依據(jù)國(guó)際時(shí)間來(lái)設(shè)置小時(shí) 依據(jù)國(guó)際時(shí)間來(lái)

2、設(shè)置分鐘 依據(jù)國(guó)際時(shí)間來(lái)設(shè)置秒 依據(jù)國(guó)際時(shí)間來(lái)設(shè)置毫秒設(shè)置從 1970 年 1 月 1 日開始的時(shí)間 根據(jù)格林威治時(shí)間將Date 對(duì)象的日期I.Date屬性:con structor所建立對(duì)象的函數(shù)參考prototype能夠?yàn)閷?duì)象加入的屬性和方法方法(43):getDay()getYear()getFullYear()getM on th()getDate()getHours() getMinu tes() getSecon ds()getMilliseconds()getUTCDay()返回一周中的第幾天(0-6)返回年份.2000 年以前為 2 位,2000(包含)以后為 4 位 返回完整

3、的 4 位年份數(shù)返回月份數(shù)(0-11)返回日(1-31)返回小時(shí)數(shù)(0-23)返回分鐘(0-59)返回秒數(shù)(0-59)返回毫秒(0-999)依據(jù)國(guó)際時(shí)間來(lái)得到現(xiàn)在是星期幾(0-6)getUTCFullYear()getUTCM on th()getUTCDate()getUTCHours()getUTCMi nutes()getUTCSeconds()依據(jù)國(guó)際時(shí)間來(lái)得到完整的年份依據(jù)國(guó)際時(shí)間來(lái)得到月份(0-11) 依據(jù)國(guó)際時(shí)間來(lái)得到日(1-31) 依據(jù)國(guó)際時(shí)間來(lái)得到小時(shí)(0-23)依據(jù)國(guó)際時(shí)間來(lái)返回分鐘(0-59)依據(jù)國(guó)際時(shí)間來(lái)返回秒(0-59)getUTCMilliseconds()依據(jù)國(guó)際

4、時(shí)間來(lái)返回毫秒(0-999)parse(dateStri ng)setYear(yearl nt)setFullYear(yearl nt)setMo nth(m on thInt) setDate(dateI nt)setHours(hourI nt)setMi nutes(mi nlnt)setSec on ds(secInt)1 月 1 日 00:00:00 以來(lái)的毫秒數(shù).毫秒數(shù)(一個(gè)數(shù)值)轉(zhuǎn)變成一個(gè) GMT 寸間字setMilliseco nds(millil nt)setUTCFullYear(yearl nt)setUTCMo nth(mo nthl nt)setUTCDate(d

5、ateI nt)setUTCHours(hourI nt)setUTCMi nutes(mi nlnt)setUTCSeco nds(secl nt)setUTCMilliseco nds(millilnt) setTime(time Int)toGMTStri ng()學(xué)習(xí)好資料歡迎下載符串,如:Weds,15 June 1997 14:02:02 GMTtoUTCString()根據(jù)通用時(shí)間將一個(gè)Date 對(duì)象的日期轉(zhuǎn)換為一個(gè)字符串toLocaleString()把 Date 對(duì)象的日期(一個(gè)數(shù)值)轉(zhuǎn)變成一個(gè)字符串,使用所在計(jì)算機(jī)上配置使用的特定日期格式toSource()顯示對(duì)象的源代碼

6、toStri ng()將日期對(duì)象轉(zhuǎn)換為字符串UTC(yyyy, mm, dd, hh, mm, ss, msec)返回從格林威治標(biāo)準(zhǔn)時(shí)間到指定時(shí)間的差距,單位為毫秒valueOf()返回日期對(duì)象的原始值方法:abs(x)返回?cái)?shù)字的絕對(duì)值acos(x)返回?cái)?shù)字的反余弦值asi n(x)返回?cái)?shù)字的反正弦值ata n(x)返回位于-PI/2 和 PI/2的反正切值ata n2(y,x)返回(x,y )位于-PI 到 PI 之間的角度ceil(x)返回 x 四舍五入后的最大整數(shù)cos(x)返回一個(gè)數(shù)字的余弦值exp(x)返回 EAx 值floor(x)返回 x 四舍五入后的最小整數(shù)log(x)返回底數(shù)

7、為 E 的自然對(duì)數(shù)max(x,y)返回 x 和 y 之間較大的數(shù)mi n(x,y)返回 x 和 y 之間較小的數(shù)pow(x,y)返回 yAx 的值ran dom()返回位于 0 到 1 之間的隨機(jī)函數(shù)roun d(x)四舍五入后取整sin(x)返回?cái)?shù)字的正弦值sqrt(x)返回?cái)?shù)字的平方根tan(x)返回一個(gè)角度的正切值toSource()顯示對(duì)象的源代碼valueOf()返回?cái)?shù)學(xué)對(duì)象的原始值2.Math屬性:con structorprototypeELN2LN10LOG2ELOG10EPISQRT1_2SQRT210所建立對(duì)象的函數(shù)參考 能夠?yàn)閷?duì)象加入的屬性和方法歐拉常量,自然對(duì)數(shù)的底(約

8、等于 2.718)的自然對(duì)數(shù)(約等于 0.693)的自然對(duì)數(shù)以 2 為底的 e以 10 為底的n的值(約等于(約等于 2.302)的對(duì)數(shù).(約等于 1.442)e的對(duì)數(shù)(約等于 0.434)3.14159)1/2(0.5) 的平方根(即 I 除以 2 的平方根,約等于 o.707)2的平方根(約等于 1.414)學(xué)習(xí)好資料歡迎下載3. Number屬性:MAX_VALUEThe largest possible value a number in JavaScript can1.7976931348623157E+308MIN_VALUE The smallest possible value

9、 a nu mber in JavaScript can have 5E-324NaN Equal to a value that is not a nu mber.NEGATIVE_INFINITY A value that is less than MIN_VALUE.POSOTIVE_INFINITY A value that is greater than MAX_VALUE.prototype A static property of the Number object方法:toStri ngRetur ns a stri ng represe nti ng the specifie

10、d objectvalueOf()返回?cái)?shù)學(xué)對(duì)象的原始值4. Boolea n屬性:con structor所建立對(duì)象的函數(shù)參考prototype能夠?yàn)閷?duì)象加入的屬性和方法方法:toSource()顯示對(duì)象的源代碼toString()將布爾值轉(zhuǎn)換為字符串,并且返回結(jié)果valueOf()返回布爾對(duì)象的原始值5.Stri ng屬性:con structor所建立對(duì)象的函數(shù)參考prototype能夠?yàn)閷?duì)象加入的屬性和方法len gth返回字符串的字符長(zhǎng)度方法(20):anchor(name)用來(lái)把字符串轉(zhuǎn)換為HTML 錨點(diǎn)標(biāo)記內(nèi)()big()把字符串中的文本變成大字體()bli nk()把字符串中的文

11、本變成閃爍字體()bold()把字符串中的文本變成黑字體()fixed()把字符串中的文本變成固定間距字體,即電報(bào)形式()fon tcolor(color)設(shè)置字符串中文本的顏色 ()Fon tsize(size)把字符串中的文本變成指定大小()italics()把字符串中的文本變成斜字體()Link(url)用來(lái)把字符串轉(zhuǎn)換-HTML 鏈接標(biāo)記中()small()把字符串中的文本變成小字體()have學(xué)習(xí)好資料歡迎下載strike()把字符串中的文本變成劃掉字體()sub()把字符串中的文本變成下標(biāo)(subscript) 字體(SUB)sup()把字符串中的文本變成上標(biāo)(superscrip

12、t) 字體()charAt(i ndex)返回指定索引處的字符charCodeAt(index)返回一個(gè)整數(shù),該整數(shù)表示 String 對(duì)象中指定位置處的字符的Unicode編碼con cat(stri ng2) 連接兩條或多條字符串fromCharCode(num1, num2,,numN)獲取指定的 Unicode 值并返回字符串in dexOf(searchStri ng, startI ndex)返回字符串中第一個(gè)出現(xiàn)指定字符串的位置lastl ndexOf(searchStri ng, startI ndex)返回字符串中最后一個(gè)出現(xiàn)指定字符串的位置match(regex)在字符串中

13、查找指定值replace(regex, n ewStri ng)將字符串中的某些字符替換成其它字符search(regex)針對(duì)某執(zhí)行值對(duì)字符串進(jìn)行查找slice(startI ndex, endln dex)將部分字符抽出并在新的字符串中返回剩余部分split(delimiter)將字符串分配為數(shù)組substr(startIndex, length)從 startIndex 取,取 length 個(gè)字符substri ng(start In dex,endln dex) 從 start In dex禾口 endln dex 之間的字符,不包括 endln dextoLowerCase()把字

14、符串中的文本變成小寫toUpperCase()把字符串中的文本變成大寫toSource()顯示對(duì)象的源代碼valueOf()返回字符串對(duì)象的原始值6.Array屬性:con structor所建立對(duì)象的函數(shù)參考prototype能夠?yàn)閷?duì)象加入的屬性和方法indexForan array created by a regular expression match, the zero-based indexof the match in the stri ng.in putForan array created by a regular expressi on match, reflects th

15、e origi nalstri ng aga inst which the regular expressi on was matched.length獲取數(shù)組元素的個(gè)數(shù),即最大下標(biāo)加 1方法(13):concat(array1,arrayn)將兩個(gè)或兩個(gè)以上的數(shù)組值連接起來(lái),合并后返回結(jié)果join(string)將數(shù)組中元素合并為字符串,string 為分隔符.如省略參數(shù)則直接合并,不再分隔pop()移除數(shù)組中的最后一個(gè)元素并返回該元素push(value)在數(shù)組的末尾加上一個(gè)或多個(gè)元素,并且返回新的數(shù)組長(zhǎng)度值reverse()顛倒數(shù)組中元素的順序,反向排列學(xué)習(xí)好資料歡迎下載shift()移

16、除數(shù)組中的第一個(gè)元素并返回該元素slice(start, deleteCou nt, item1, item2,.,itemN)返從一個(gè)數(shù)組中移除一個(gè)或多個(gè)元素,如果必要,在所移除元素的位置上插入新元素,返回所移除的元素sort(compare Function)在未指定排序號(hào)的情況下,按照元素的字母順序排列,如果不是字符串類型則轉(zhuǎn)換成字符串再排序,返回排序后的數(shù)組splice()為數(shù)組刪除并添加新的元素toSource()顯示對(duì)象的源代碼toString()將數(shù)組所有元素返回一個(gè)字符串,其間用逗號(hào)分隔unshift(value)為數(shù)組的開始部分加上一個(gè)或多個(gè)元素,并且返回該數(shù)組的新長(zhǎng)度val

17、ueOf()返回?cái)?shù)組對(duì)象的原始值7. RegExp屬性:$1, ., $9 Paren thesized substri ng matches, if any.$_See in put.$*See multili ne.$&See lastMatch.$+See lastPare n.$See leftCo ntext.$See rightCo ntext.global Whether or not to test the regular expressi on aga inst all possible matches in a string, or onlyagainst the

18、first.igno reCase Whether or not to ignore case while attempti ng a match in a stri ng.in putThe stri ng aga inst which a regular expressi on is matched.lastI ndex The in dex at which to start the n ext match.lastMatch The last matched characters.lastPare n The last pare nthesized substri ng match,

19、if any. leftC on text The substri ng precedi ng themost recent match. multil ine Whether or not to search in stri ngs across multiple lin es. rightC on textThe substri ng follow ing the most recent match.source The text of the patter n.方法:compile Compiles a regular expressi on object.exec Executes a

20、 search for a match in its stri ng parameter.test Tests for a match in its stri ng parameter8. F unction屬性:argume nts An array corresp onding to the argume nts passed to a function. arity In dicates the number of argume nts expected by the fun cti on.callerSpecifies which fun ctio n called the curre

21、 nt fun ctio totype Allows the additi on of properties to a Function object.學(xué)習(xí)好資料歡迎下載方法:toStri ngRetur ns a stri ng represe nti ng the specified object.9.Object屬性:con structor Specifies the function that creates an objects prototype. prototype Allows the additi on ofproperties to all objects.方法

22、:eval Evaluates a stri ng of JavaScript code in the con text of the specified object.toStri ngRetur ns a stri ng represe nti ng the specified object.unwatch Removes a watchpoint from a屬性源 the object.valueOfRetur ns the primitive value of the specified object.watch Adds a watchpoint to a屬性源 the objec

23、t.10.全局屬性:Infin ity指定一個(gè)正負(fù)無(wú)窮大的數(shù)值NaN指定一個(gè) “非數(shù)字” 值un defi ned指定一個(gè)未被賦值的變量 方法:decodeURI()為加密的 URI 進(jìn)行解碼decodeURIComponent()為加密的 URI 組件解碼 en codeURI()將字符串加密為 URIencodeURIComponent()將字符串加密為 URI 組件escape(stri ng) unescape()加密一個(gè)字符串使用 escape()對(duì)一個(gè)字符串進(jìn)行解碼eval(stri ng)判斷一個(gè)字符串并將其以腳本代碼的形式執(zhí)行nu mber(object) 11.事件屬性:a.窗口事件,只在 body 和 frameset 元素中才有效onl oad頁(yè)面或圖片加載完成時(shí)onun load用戶離開頁(yè)面時(shí)b.表單元素事件,在表單元素中才有效onchangeon submiton reset框內(nèi)容改變時(shí)點(diǎn)擊提交按鈕時(shí) 重新點(diǎn)擊鼠標(biāo)按鍵時(shí)isNaN(stri ng)Number()parseFloat(stri ng)parse In t(stri ng)檢測(cè)一個(gè)值是否不是一個(gè)有限數(shù)字將一個(gè)對(duì)象的值轉(zhuǎn)換為一個(gè)數(shù)字將一個(gè)字符串解析為一個(gè)浮點(diǎn)數(shù)字將一個(gè)字符串解析為一個(gè)整數(shù),不是四舍五入操作,而是切尾isFin ite (number)檢測(cè)一個(gè)值是

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論