Javascript 使用jquery在按钮单击中隐藏/显示HTML内部表

Javascript 使用jquery在按钮单击中隐藏/显示HTML内部表,javascript,jquery,Javascript,Jquery,我尝试过使用jquery隐藏和显示html内部表。我想在页面加载时隐藏表格,然后单击“搜索”按钮后,表格将显示值 但下面的代码是隐藏的初始,点击搜索按钮后,它再次闪烁和隐藏。请告知这里有什么问题 $(document).ready(function() { $("#historylist").hide(); $("#historysearch").click(function() { $("#historylist").show(); }); // } }); <tabl

我尝试过使用jquery隐藏和显示html内部表。我想在页面加载时隐藏表格,然后单击“搜索”按钮后,表格将显示值

但下面的代码是隐藏的初始,点击搜索按钮后,它再次闪烁和隐藏。请告知这里有什么问题

$(document).ready(function() {

 $("#historylist").hide();

$("#historysearch").click(function() {
 $("#historylist").show();
});
// }
});    

<table id="searchTbl" width="800" >
<tr>
<td valign="top">Release No</td>
<td valign="top">
<input type="text" name="releaseNo" value="" style="width:200" />
</td>
<td valign="top"><input type="button" value="Search" onClick="commit()" style="width:80" id="historysearch"/></td>
</tr>
<br /><br />
<table border="1" cellpadding="2" cellspacing="0" id="historylist">
<tr>
<th><font size="-1">Header1</font></th>
<th><font size="-1">Header2</font></th>
<th><font size="-1">Header3</font></th>
<th><font size="-1">Header4</font></th> 
<th><font size="-1">Header5</font></th>


</tr>
</table>
</table>

function commit(){

        document.menu.cmd.value='search';
        document.menu.submit();
    }
你能试试这个吗

  function commit(){         
      $("#historylist").toggle();
  }

如果调用提交函数onclick,请检查函数.show和hide是否正确。您可以在提交中发布代码吗?您不能将表/br作为表的子表。如果您解决了它应该可以正常工作的问题,请删除onClick,因为您正在使用Jquery运行检查。@ArunPJohny:这不是重点。即使将表嵌入到表中,jQuery也很好。我怀疑提交函数做了些什么。