Window對象###
encodeURI
對漢字進(jìn)行編碼decodeURI
對encodeURI后的編碼解碼encodeURIComponent
編碼 當(dāng)提交的值中包含一些url中的敏感符號(hào)時(shí),使用該方法對敏感符號(hào)編碼.decodeURIComponent
解碼
****注:全局對象的方法直接使用即可。****
Math###
(屬性) PI
值為圓周率random
返回隨機(jī)數(shù) 0~1之間的隨機(jī)數(shù) 包括0不包括1round
返回值為四舍五入后的數(shù)值max/min
接收兩個(gè)參數(shù),比較之后返回最大/最小的那個(gè)pow
//計(jì)算參數(shù)1的參數(shù)2次方
alert(Math.max(1,2));//2
****注:Math屬性內(nèi)建對象==> 不需要?jiǎng)?chuàng)建實(shí)例,直接使用即可.。****
Date###
1.new Date() 獲取當(dāng)前時(shí)間
2.getFullYear() 獲取年份
3.getMonth() 獲取月份注意 1月份結(jié)果為0
4.getHours() 小時(shí)
5.getDate() 日期
6.getMinutes() 分鐘
7.getSeconds() 獲取秒
8.getTime() 獲取毫秒值.
9.toLocaleString() 獲取本地的時(shí)間格式字符串.
10.getDay();獲得星期
****注:1.月份計(jì)數(shù)時(shí)是0~11月,所以要加1獲得正常月份 2.星期計(jì)數(shù)是 0~6 .****