谁知道这个怎么写?

chunfengdeyi 2005-08-16 04:30:10
要求实现一个时钟效果 是服务器 时间的时钟 谁知道怎么写
...全文
124 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
chunfengdeyi 2005-08-18
  • 打赏
  • 举报
回复
谁知道 怎么做 啊 服务器时间的 时钟
chunfengdeyi 2005-08-18
  • 打赏
  • 举报
回复
怎么把 取得的服务器时间 传给 js

放在hidden里 怎么 做 ?

麻烦你了
lovefootball 2005-08-18
  • 打赏
  • 举报
回复
你把服务器的时间给js不就行了么?
比如放在hidden里
chunfengdeyi 2005-08-18
  • 打赏
  • 举报
回复
我要的是 服务器的时间 啊 谁知道怎么作?
莫情莫钱 2005-08-16
  • 打赏
  • 举报
回复
学习
share1011 2005-08-16
  • 打赏
  • 举报
回复
风格一: 星期四,8月11日,2005年
风格二: 10:33:46上午
风格三: 星期四,8月11日,2005年 10:33:46上午
风格四: 8/11/05
风格五: 10:33:46
风格六: Thu Aug 11 10:33:46 UTC+0800 2005
<SCRIPT language="javascript">
<!--
function initArray()
{
for(i=0;i<initArray.arguments.length;i++)
this[i]=initArray.arguments[i];
}
var isnMonths=new initArray("1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月");
var isnDays=new initArray("星期日","星期一","星期二","星期三","星期四","星期五","星期六","星期日");
today=new Date();
hrs=today.getHours();
min=today.getMinutes();
sec=today.getSeconds();
clckh=""+((hrs>12)?hrs-12:hrs);
clckm=((min<10)?"0":"")+min;clcks=((sec<10)?"0":"")+sec;
clck=(hrs>=12)?"下午":"上午";
var stnr="";
var ns="0123456789";
var a="";
function getFullYear(d)
{
yr=d.getYear();if(yr<1000)
yr+=1900;return yr;}
document.write("<table>");
//下面各行分别是一种风格,把不需要的删掉即可
document.write("<TR><TD>风格一:</TD><TD>"+isnDays[today.getDay()]+","+isnMonths[today.getMonth()]+""+today.getDate()+"日,"+getFullYear(today)+"年");
document.write("<TR><TD>风格二:</TD><TD>"+clckh+":"+clckm+":"+clcks+""+clck+"</TD></TR>");
document.write("<TR><TD>风格三:</TD><TD>"+isnDays[today.getDay()]+","+isnMonths[today.getMonth()]+""+today.getDate()+"日,"+getFullYear(today)+"年 "+clckh+":"+clckm+":"+clcks+""+clck+"</TD></TR>");
document.write("<TR><TD>风格四:</TD><TD>"+(today.getMonth()+1)+"/"+today.getDate()+"/"+(getFullYear(today)+"").substring(2,4)+"</TD></TR>");
document.write("<TR><TD>风格五:</TD><TD>"+hrs+":"+clckm+":"+clcks+"</TD></TR>");
document.write("<TR><TD VALIGN=TOP>风格六:</TD><TD>"+today+"</TD></TR>");
document.write("</table>");
//-->
</SCRIPT>
祥子_13 2005-08-16
  • 打赏
  • 举报
回复
<%@ Page language="c#" Codebehind="DateTimeDisp.aspx.cs" AutoEventWireup="false" Inherits="XHEAM.DateTimeDisp" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >

<html>
<head>
<title>DateTimeDisp</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name=vs_defaultClientScript content="JavaScript">
<meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie5">
<LINK href="Base.css" type="text/css" rel="stylesheet">
<script language="javascript">
var today;
function tick() {
if(today==null)
{
today = new Date();
today.setFullYear(<%=strY%>,<%=strM%>,<%=strD%>)
today.setHours(<%=strH%>);
today.setMinutes(<%=strMM%>);
today.setSeconds(<%=strS%>);
}
today.setSeconds(today.getSeconds()+1);
LabMsg.innerHTML ='<nobr>'+today.getFullYear()+"-"+(today.getMonth()+1)+"-"+today.getDate()+" "+today.toLocaleTimeString()+'</nobr>';
window.setTimeout("tick()", 1000);
}
</script>
</HEAD>
<body bottomMargin="0" leftMargin="0" topMargin="0" rightMargin="0" class="color3"
scroll="no" onload="tick()">
<form id="Form1" method="post" runat="server">
<a href="wnl_js.htm" target="_blank"><span id="LabMsg" style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial Black'" name="LabMsg">
</span></a>
</form>
</body>
</HTML>


using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace XHEAM
{
/// <summary>
/// DateTimeDisp 的摘要说明。
/// </summary>

public class DateTimeDisp : System.Web.UI.Page
{
protected int strY, strM, strD, strMM, strH, strS;
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
strY = DateTime.Now.Year;
strM = DateTime.Now.Month - 1;
strD = DateTime.Now.Day;
strMM = DateTime.Now.Minute;
strH = DateTime.Now.Hour;
strS = DateTime.Now.Second;
}

#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
}

62,071

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧