本文介绍了onclick调用hide-div功能不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在与这段简单的代码作战。我试图用

尝试更改关闭因为它可能会将它与 window.close()函数混淆。> p>

I've been fighting with this simple piece of code forever. I'm trying to use a <button> to call a simple JavaScript function to hide a <div>.

HTML:

<button type="button" onclick="close('wrong')">OK</button>

JavaScript:

function close(ID)
{
    document.getElementById(ID).style.display="none";
}

I'm sure it's something really simple, I just can't, for the life of me, find it.

解决方案

Try changing the close function name to something else like closeit because it may be confusing it with the window.close() function.

这篇关于onclick调用hide-div功能不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 14:21