场景:全选,不选,反选。
场景1.单纯的html,无JS代码干预,查看DOM的初始checked attributes
和properties
属性
-输入:
A:<input type='checkbox'>
B:<input type='checkbox'>
-输出:
-DOM 的checked attributes
和properties
:
//attributes
null
//properties
checked:false
场景2.继场景1后鼠标点击input勾选checkbox
-输出:
-DOM 的checked attributes
和properties
:
//attributes
null
//properties
checked:true
场景1+场景2表明,properties是浏览器的状态映射。即properties反映了浏览器的状态。
场景3.单纯使用JSsetAttribute('checked',true)
来设置DOM的checked属性:
-输入: