----- 访问 html 元素 -----


 input 
/*---------- html ----------*/
<input type="number" id="a" placeholder="请输入">
 
/*---------- javascript ----------*/
//读取(string) 
const a = document.getElementById('a').value;  //string
const a = document.getElementById('a').checked;  //bool ;type="checkbox",状态
//赋值
document.getElementById('a').value = 5;