关于onclick事件关闭一个DIV的问题

来源:百度知道 编辑:UC知道 时间:2024/06/10 07:05:55
<div id="help" class="ye_r_t"><div class="ye_l_t"><div class="ye_r_b"><div class="ye_l_b">
<div class="task_notice">
<a title="忽略" class="float_cancel" href="javascript:;" onclick="close_help();">忽略</a>
<div class="task_notice_body">
</div>
</div>
</div></div></div></div>

要把div id="help"关闭,但没效果呢?

把下面这句改一下:
<a class="float_cancel" href="javascript:void(0);" onclick="close_help();">忽略</a>
然后在页面head部分里加入这段脚本
<script>
function close_help(){
document.getElementById(help).style.display="none";
}
</script>

把你的JS贴出来啊

function close_help(){
document.getElementById('help').style.display="none";
}

不知道你的函数是怎么写的
function close_help(){
document.getElementById('help').style.display='none';
}