asp.net 用timer控件 计时,秒数只跳了一下就不动了 30
前端代码<divalign="center"><asp:ScriptManagerID="ScriptManager1"runat="server"></asp:Scri...
前端代码
<div align="center">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Label ID="Label6" runat="server" Font-Size="9pt" Height="19px" Text=""></asp:Label>
<asp:Timer ID="Timer1" runat="server" Interval="1000" ontick="Time1_Tick"></asp:Timer>
</ContentTemplate>
</asp:UpdatePanel>
</div>
后端
public int seconds ;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
seconds = 0;
Label6.Text = seconds.ToString()+"秒";
}
Timer1.Enabled = true;
}
protected void Time1_Tick(object sender, EventArgs e)
{
seconds++;
Label6.Text = seconds.ToString() + "秒";
}
帮我看看哪里有错啊 展开
<div align="center">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Label ID="Label6" runat="server" Font-Size="9pt" Height="19px" Text=""></asp:Label>
<asp:Timer ID="Timer1" runat="server" Interval="1000" ontick="Time1_Tick"></asp:Timer>
</ContentTemplate>
</asp:UpdatePanel>
</div>
后端
public int seconds ;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
seconds = 0;
Label6.Text = seconds.ToString()+"秒";
}
Timer1.Enabled = true;
}
protected void Time1_Tick(object sender, EventArgs e)
{
seconds++;
Label6.Text = seconds.ToString() + "秒";
}
帮我看看哪里有错啊 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询