【发布时间】:2009-11-30 16:53:44
【问题描述】:
这是我的代码:
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="txtInsertComments" CssClass="expanding" runat="server" AutoPostBack="false" TextMode="MultiLine"></asp:TextBox>
</div>
<div id="commands">
<table cellpadding="0" cellspacing="0" width="400px" id="tblCommands">
<tr>
<td style="width: 50%; text-align: center;">
<asp:LinkButton ID="lnbInsertRes" runat="server" CommandName="Insert" Font-Underline="false">Insert</asp:LinkButton>
</td>
<td style="width: 50%; text-align: center;">
<asp:LinkButton ID="lnbCancelRes" runat="server" CommandName="Cancel" Font-Underline="false">Cancel</asp:LinkButton>
</td>
</tr>
</table>
</div>
</form>
</body>
<script type="text/javascript">
$(function()
{
$("#commands").hide("normal");
$("textarea[id$=txtInsertComments]").focus(function()
{
$("#commands").show("normal");
});
});
</script>
</html>
首先,当这个页面被加载时,div #command 被加载得非常快,然后就消失了。我需要 div 保持隐藏,直到文本框 txtInsertComments 控件被单击或获得焦点。
其次,当用户点击文本框 txtInsertComments 或者文本框失去焦点时,div #command 仍然存在并且没有隐藏。
感谢任何帮助。
【问题讨论】: