如何使用Java脚本刷新网格视图内的标签?

发布于 2024-09-26 14:25:51 字数 364 浏览 1 评论 0 原文

我在网格视图内的标签中显示时间。我需要每秒刷新标签。如何通过Java脚本来做到这一点。就像Ajax计时器一样。

编辑:

OnLoad="setTimeout(window.location.reload();.1000);" 此代码或

i am displaying time in the label which is inside the grid view. i need to Refresh the label every second. how to do this by Java script.Like Ajax timer.

EDIT:

OnLoad="setTimeout(window.location.reload();. 1000);" whats wrong with this code or <asp:Label ID="Label2" Width="100px" runat="server" OnLoad="setTimeout(window.location.reload();. 1000);" Font-Size="12px" ForeColor="Black" Text='<%# Bind("time") %>'></asp:Label>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

居里长安 2024-10-03 14:25:51
setInterval(function(){
  var now = new Date();
  $('#yourSpanId').text(now.toUTCString()); // or whatever formatting you need
}, 1000);
setInterval(function(){
  var now = new Date();
  $('#yourSpanId').text(now.toUTCString()); // or whatever formatting you need
}, 1000);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文