<script>
function $(id){
return document.getElementById('id');
}
function doChange(){
console.log($("baidu").checked);//报错
}
function doChange(){
console.log(document.getElementById("baidu").checked);//正确
}
</script>
<body>
<form id="myFrm" action="">
<!-- <a id="baidu" href="http://www.baidu.com" target="_blank">百度</a> -->
<input type="radio" name="search" id="baidu" checked="checked" onclick="doChange()">
<label for="baidu">百度</label>
<input type="radio" name="search" id="google" onclick="doChange()">
<label for="google">谷歌</label>
<input type="radio" name="search" id="bing" onclick="doChange()">
<label for="bing">必应</label>
</form>
</body>