document.getElementById().value和document.getElementById().innerHTML的区别

1 <input type=”text”id=”id1”value=”hello”>this is id</input>
2 document.getElementById().value = hello 
3 document.getElementById().innerHTML = this is id

延伸:分别在什么场合用?

——文本域(font,div,table等)用innerHTML,元素(checkbox,radio,text等)用value。

posted @ 2018-03-20 10:14  wisdomns  Views(1069)  Comments(0Edit  收藏  举报