gpt4 book ai didi

jQuery 在 aspx 页面中无法正确显示

转载 作者:行者123 更新时间:2023-12-01 04:26:16 25 4
gpt4 key购买 nike

我试图让这个函数在 aspx 页面中工作,但我过得很糟糕。基本上它在常规 HTML 页面中工作正常,但在 aspx 页面中,当单击按钮时,您只能看到顶部的一小部分,有时(每 5 个以上的单按钮单击和每次双击)消息会显示并消失就像它应该的那样。我缺少什么?它会被困在回发中吗?

FIDDLE HERE

在aspx页面中使用的代码

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="checkTest.aspx.cs" Inherits="WebApplication2.checkTest" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script type="text/javascript">
$(function () {
$("#Button1").click(function () {
$(".message").stop(true,true).slideToggle().fadeOut(6000);
});
});
</script>
<style type="text/css">
.message{height:70px;display:none;}
.noChangesMessage{width:84px;padding:8px 8px; background:#535353; -webkit-border-radius:5px; -moz-border-radius:5px; border-radius:5px; color:white;text-align:center;}
.tipEnd{width:0;height:0;border-left:10px solid transparent;border-right:10px solid transparent;border-top:10px solid #535353;margin:0 auto;}

</style>
</head>
<body>
<form id="form1" runat="server">



<br /><br /><br />
<div>
<div style="width:100px">
<div style="height:70px">
<div style="margin-bottom:5px;" class="message">
<div class="noChangesMessage">No changes were made!</div>
<div class="tipEnd"></div>
</div></div>
<div style="">
<asp:Button ID="Button1" runat="server" Text="Save Changes" />
</div>
</div>

</div>


</form>
</body>
</html>

我的代码通过查看 amit_g 的源代码

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>
</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script type="text/javascript">
$(function () {
$("#Button1").click(function () {
$(".message").stop(true,true).slideToggle().fadeOut(6000);
});
});
</script>
<style type="text/css">.
.message{height:70px;display:none;}
.noChangesMessage{width:84px;padding:8px 8px; background:#535353; -webkit-border-radius:5px; -moz-border-radius:5px; border-radius:5px; color:white;text-align:center;}
.tipEnd{width:0;height:0;border-left:10px solid transparent;border-right:10px solid transparent;border-top:10px solid #535353;margin:0 auto;}
</style>
</head>
<body>
<form method="post" action="checkTest.aspx" id="form1">
<div class="aspNetHidden">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKMjA0OTM4MTAwNGRkU+SP3bu4QJNH9S9XtdwPbEE8YODY/YlkotOt6l692s8=" />
</div>
<div class="aspNetHidden">
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWAgKroLr3AwKM54rGBtLTfCTwYmYnb6l8tnp5jtojhvORYMJ6bPzAI+qbaDlU" />
</div>
<br /><br /><br />
<div>
<div style="width:100px">
<div style="height:70px">
<div style="margin-bottom:5px;" class="message">
<div class="noChangesMessage">No changes were made!</div>
<div class="tipEnd"></div>
</div></div>
<div style="">
<input type="submit" name="Button1" value="Save Changes" id="Button1" class="Button1" /></div>
</div>
</div>
</form>
</body>
</html>

最佳答案

试试这个:

$("#<%= Button1.ClientID %>").click(function () {    
$(".message").stop(true,true).slideToggle().fadeOut(6000);}
);

关于jQuery 在 aspx 页面中无法正确显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6207919/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com