我正在尝试添加一个在我按下按钮时淡入/淡出的 div。这是我的 ASP 头中的代码:
<script type="text/javascript">
$(this.document).ready(function () {
$("#<%=this.button1.ClientID %>").click(function () {
$("#mydiv").fadeToggle();
});
});
</script>
然后在正文中:
<asp:Button ID="button1" runat="server" Text="button" />
<div id="mydiv" style="display:none">
Load page with fade in effect...<br />
Load page with fade in effect...<br />
Load page with fade in effect...<br />
Load page with fade in effect...<br />
Load page with fade in effect...<br />
Load page with fade in effect...<br />
Load page with fade in effect...<br />
Load page with fade in effect...<br />
Load page with fade in effect...<br />
Load page with fade in effect...<br />
Load page with fade in effect...<br />
Load page with fade in effect...<br />
Load page with fade in effect...<br />
</div>
当我测试它时,按钮在那里,但当我按下它时没有任何反应。当我重复按垃圾邮件时,我可以看到 div 开始淡入/淡出,但只是闪烁了一毫秒。