A.setAttribute(‘true’)和A.屬性=‘值’區(qū)別
var A = document.getElementById('one'); A.getAttribute(‘checked’)和A.setAttribute(‘true’) ? 方法和 ? ?A.checked ="true"; ?這樣都行吧? 怎么取舍,什么時(shí)候用什么呢
var A = document.getElementById('one'); A.getAttribute(‘checked’)和A.setAttribute(‘true’) ? 方法和 ? ?A.checked ="true"; ?這樣都行吧? 怎么取舍,什么時(shí)候用什么呢
2017-03-22
舉報(bào)
2017-03-22
直接賦值相當(dāng)于改變內(nèi)容,但是用setAttribute除了改變內(nèi)容,還可以新增內(nèi)容,功能多了一種,對(duì)于改變來(lái)說(shuō),兩種都差不多,看你習(xí)慣用哪種了