社区
Web 开发
帖子详情
求一显示小时分钟秒的程序,要秒会变的,像这种格式19:30:56。30分只给一个人
住楼上的老丁
2003-05-21 08:02:28
求一显示小时分钟秒的程序,要秒会变的,像这种格式19:30:56。千万不要刷新的太累了
...全文
100
6
打赏
收藏
求一显示小时分钟秒的程序,要秒会变的,像这种格式19:30:56。30分只给一个人
求一显示小时分钟秒的程序,要秒会变的,像这种格式19:30:56。千万不要刷新的太累了
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
6 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
凋零的老树
2003-05-22
打赏
举报
回复
<script Language="JavaScript">
var timerID = null;
var timerRunning = false;
function stopclock (){
if(timerRunning)
clearTimeout(timerID);
timerRunning = false;
}
function showtime () {
var now = new Date();
var year = now.getYear();
var month= now.getMonth()+1;
if (month<10)
month = "0" + month;
var days = now.getDate();
if (days<10)
days = "0" +days;
var hours = now.getHours();
var minutes = now.getMinutes();
var seconds = now.getSeconds()
var timeValue = "" + ((hours >12) ? hours -12 :hours)
timeValue += ((minutes < 10) ? ":0" : ":") + minutes
timeValue += ((seconds < 10) ? ":0" : ":") + seconds
timeValue += (hours >= 12) ? " P.M. " : " A.M. "
timeValue += "版权所有,不得翻录,违者必究";
window.status = year+"-"+month+"-"+days+" "+timeValue;
timerID = setTimeout("showtime()",1000);
timerRunning = true;
}
function startclock () {
stopclock();
showtime();
}
</script>
<script language="javascript">
startclock();
</script>
shaopin
2003-05-22
打赏
举报
回复
<script>
function scroll()
{
dt=new Date();
sec=dt.getSeconds();
hr=dt.getHours();
ampm="A.M.";
smin=dt.getMinutes();
if (hr >=12) ampm="P.M.";
if (hr > 12) hr -=12;
if (smin <= 9) smin = "0"+smin;
if (sec <= 9) sec = "0"+sec;
if (hr <= 9) hr = "0"+hr;
var scroller="当前时间:"+hr+":"+smin+":"+sec+" "+ampm;
var timeout=setTimeout("scroll()", 1000);
clock.innerText=scroller;
}
</script>
<table><tr><td id=clock>
<script>scroll()</script>
住楼上的老丁
2003-05-22
打赏
举报
回复
谢谢大家的帮助,我的要求很简单,所以决定用shappin的代码。现在屡行我的承诺。
qiangliu666
2003-05-21
打赏
举报
回复
说明一下 applet小程序:
类文件Clock.class于html文件放在同一目录下。
qiangliu666
2003-05-21
打赏
举报
回复
//file name:Clock.java
import java.awt.*;
import java.util.Date;
public class Clock extends java.applet.Applet implements Runnable{
Thread clockThread;
public void start(){ // 鍦ˋpplet鐨剆tart鏂规硶涓垱寤哄苟鍚姩绾跨▼
if(clockThread==null){
clockThread=new Thread(this,"Clock");
clockThread.start(); // 鍚姩
}
}
public void run(){
while(clockThread!=null){
repaint();
try{
clockThread.sleep(1000);
}
catch(Exception e){}
}
}
public void paint(Graphics g){ // 璋冪敤drawString鏂规硶鐢诲嚭鏃躲€佸垎銆佺
Font f=new Font("TimesRoman",Font.BOLD,24);
g.setFont(f);
Date now=new Date();
g.drawString(now.getHours()+":"+now.getMinutes()+":"+now.getSeconds(),20,40);
}
public void stop(){ // 鍦ˋpplet鐨剆top鏂规硶涓娇绾跨▼娑堜骸
clockThread=null; // 涔熷彲鐢╟lockThread.stop();
}
}
HTML鏂囦欢锛?
<html>
<body>
<applet code="Clock.class" WIDTH=200 HEIGHT=70>
</applet>
</body>
</htmp>
wellsoon
2003-05-21
打赏
举报
回复
javascript的:
<!-- Time-->
<html>
<head>
<title>Time</title>
<style>
body { border: 0; background-color: buttonface; color: black; margin: 3px,0,0,0 }
.clocktxt { font-family: Arial; font-weight: normal; font-size: 8pt }
#btnsd { border: 2px groove white; background-color: buttonface; font-family: verdana; font-size: 9px }
</style>
<script language="JavaScript">
//Clock Script
var showclock;
function init(){
showdate()
showclock=true;
}
function showdate(){
//edit refresh rate here
var refreshrate=1000;
var Clock=new Date()
var hours=Clock.getHours()
var minutes=Clock.getMinutes()
var seconds=Clock.getSeconds()
var dn="AM"
if (hours>12){
dn="PM"
hours=hours-12
}
if (hours==0) hours=12
if (minutes<=9) minutes= "0" + minutes
if (seconds<=9) seconds= "0" + seconds
//edit format here
format = hours+":"+minutes+":"+seconds+" "+dn;
Time.innerHTML=format;
if (showclock==false) Time.innerHTML="<input type='button' value='Sh.time' id='btnsd' title='Show time'>"
else
setTimeout("showdate()",refreshrate)
}
</script>
</head>
<body scroll="no" onLoad="init()">
<center>
<font class="clocktxt"> <span id="Time" style="position:center;"></span></font>
<h1>test text!!!</h1>
</body>
</html>
python输出一年有多少天多少时分
秒
_python编程如何
显示
从
19
70年1月1日到今天多少天又多少
小时
...
python编程如何
显示
从
19
70年1月1日到今天多少天又多少
小时
有两个模块可以实现:time 和 datetime在time模块中:time()函数返回的是
19
70-1-1 0:0:0 到现在的
秒
数,例如:>>> import time>>> time....
终于有人把股市集合竞价的秘密说清楚了
15—-9:20这五
分钟
开放式集合竞价可以委托买进和卖出的单子,你看到的匹配成交量可能是虚假的,因这5
分钟
是可以撤单,很多主力在9:
19
:
30
左右撤单,当你买进时,你不撤单,他可撤出,然后他卖给你,因此你一定要把...
【java】java如何保留时分
秒
存取mySql中的datetime类型数据的方法 及
显示
时间与数据库存放时间相差n
小时
的解决方法
Date数据存入mysql数据库后,时分
秒
消失不见,归为0。 参考: 一、问题描述 console 在java里Date date = new Date();后得到的uploadtime=Wed Nov 11 16:
56
:12 CST 2020, offtime=Wed Nov 11 16:
56
:12 CST 2020 ...
java计算两个字符串
格式
的时间间隔多少天多少
小时
多少
分钟
传入起止时间,及SimpleDateFormat 的
格式
。 计算一下我晚上睡了多久: @Test public void test04() throws Exception { long min = dateDiff("2020-07-13 23:58:
56
","2020-07-14 7:29:15","yyyy-MM-dd HH:mm:ss...
微软面试58道逻辑面试题
一、微软面试58逻辑推理题 1、你让工人为你工作7天,给工人的回报是一根金条。金条平分成相连的7段 ...次此桥最多可过两人,而过桥的速度依过桥最慢者而定,而且灯在点燃后
30
秒
就
会
熄灭。问:小明
Web 开发
81,116
社区成员
341,738
社区内容
发帖
与我相关
我的任务
Web 开发
Java Web 开发
复制链接
扫一扫
分享
社区描述
Java Web 开发
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章