监听checkbox事件
<!DOCTYPE html> <html> <head> <title></title> </head> <script> function onClickHander(obj){ if(obj.checked){ console.log("selected"); }else{ console.log("unselected"); } } </script> <body> <input id="checkBox" type="checkbox" onclick="onClickHander(this)"></input> </body> </html>