1、數(shù)據(jù)類型(六種ES5)
(1)number//數(shù)字324, NaN(not a number)
(2)string //字符串“asfaf”
(3)boolean//布爾值"true&&false"
(4)function//函數(shù)function(){}
(5)object//對象[],{},null
(6)undefined//未定義var a;a為未定義
typeof查看數(shù)據(jù)類型
isNaN來判斷是否為NaN
2马胧、if語句的六種false
(1)flase
(2)0
(3)null
(4)undefined
(5)NaN
(6)""http://空字符串
3汉买、自定義屬性的使用
for (var i = 0; i < aLi.length; i++) {
aLi[i].goudan = i;//一般用來存值
aLi[i].onclick = function() {
alert(this.goudan)//值為0-長度值減一。
}
}
4佩脊、自定義標簽屬性
寫在標簽中的屬性
setAttribute(obj,屬性值)
getAttribute(obj,屬性值)//獲取和設(shè)置