jqueryを使用して、次のコードを含むリンクラベル付きのテーブルを表示できます。
$(document).ready(function()
{
$("#show").click(function()
{
$("#table").show();
});
});
しかし、ボタンに対してこれを実行したい場合は、テーブルが1秒間表示されてから、非表示になります。これらはボタンのコードです:
$(document).ready(function()
{
$("#button").click(function()
{
$("#table").show();
});
});
アップデート :
$(document).ready(function()
{
$("#table").hide();
$("#button").click(function()
{
$("#table").show();
});
});
コードは次のとおりです。
<script type="text/javascript" src="jquery-1.8.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
$("#table").hide();
$("#button").click(function()
{
$("#table").show();
});
});
</script>
</head>
<body>
<p><a href="#" id="show">Show</a> <a href="#" id="hide">Hide</a></p>
<form id="form1" name="form1" method="post" action="">
<p>
<input type="submit" name="button" id="button" value="Show" />
</p>
<p> </p>
</form>
<table width="515" border="0" class="table1" id="table">
<tr>
<td width="509" class="table1"><img src="Image/Tulips.jpg" width="400" height="400" alt="Tulips" /></td>
</tr>
</table>