前台动态隐藏span报0x800a138f - JavaScript 运行时错误: 无法获取未定义或 null 引用的属性“style”,请高手们看看。
代码如下:
<span id="C1_b_xh" style="display:block;float: left; background-color:white; color:rgb(204, 204, 204); padding-top: 5px;"> 请输入学号(Student ID)</span>
<input id="Button1" type="button" value="button" onclick="test()"/>
<script type="text/JavaScript">
function test() {
document.getElementById("b_xh").style.display = "none";
}
</script>
报错:0x800a138f - JavaScript 运行时错误: 无法获取未定义或 null 引用的属性“style”