本文介绍了document.getElementById("test").style.display ="hidden"不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我单击提交按钮时,我想隐藏我的表单.我的代码如下:
I want to hide my form when I click on the submit button. My code is as follows:
<script type="text/javascript">
function hide() {
document.getElementById("test").style.display = "hidden";
}
</script>
<form method="post" id="test">
<table width="60%" border="0" cellspacing="2" cellpadding="2">
<tr style="background:url(../images/nav.png) repeat-x; color:#fff; font-weight:bold"
align="center">
<td>Ample Id</td>
<td>Find</td>
</tr>
<tr align="center" bgcolor="#E8F8FF" style="color:#006">
<td>
<input type="text" name="ampid" id="ampid" value="<?php echo $_POST['ampid'];?>"
/>
</td>
<td>
<input type="image" src="../images/btnFind.png" id="find" name="find"
onclick="javascript:hide();" />
</td>
</tr>
</table>
</form>
但是当我单击查找"按钮时,该特定表单并未被隐藏.
But when I click on the "Find" button, that particular form is not being hidden.
推荐答案
应该为
document.getElementById("test").style.display = "none";
或
document.getElementById("test").style.visibility = "hidden";
第二个选项将在表单最初出现的地方显示一些空白,而第一个选项不显示
Second option will display some blank space where the form was initially present , where as the first option doesn't
这篇关于document.getElementById("test").style.display ="hidden"不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!