62,041
社区成员
发帖
与我相关
我的任务
分享
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="interval.aspx.cs" Inherits="WebTest.Content._201808.interval" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<script>
window.onload = function () {
let jishiData = 1,
maxNumber = 10; // 这两个值可以从cs文件中定义
let jishiTimer = window.setInterval(function () {
document.getElementById('jishi').setAttribute('value', jishiData++)
if (jishiData > maxNumber) clearInterval(jishiTimer);
}, 1000);
}
</script>
</head>
<body>
<input id="jishi" value=""/>
</body>
</html>