1、
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
dayName = new Array("", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday")
monName = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December")
now = new Date
// End -->
</script>
<SCRIPT LANGUAGE="JavaScript">
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Begin
var strDay;
if ((now.getDate() == 1) || (now.getDate() != 11) && (now.getDate() % 10 == 1)) // Correction for 11th and 1st/21st/31st
strDay = "st ";
else if ((now.getDate() == 2) || (now.getDate() != 12) && (now.getDate() % 10 == 2)) // Correction for 12th and 2nd/22nd/32nd
strDay = "nd ";
else if ((now.getDate() == 3) || (now.getDate() != 13) && (now.getDate() % 10 == 3)) // Correction for 13th and 3rd/23rd/33rd
strDay = "rd ";
else
strDay = "th ";
document.write(
dayName[now.getDay()]
+
" the "
+
now.getDate()
+
strDay
+
"of "
+
monName[now.getMonth()]
+
", "
+
now.getFullYear()
)
// End -->
</script>
*******************************************************************************
2、
代码演示效果为“
2007年2月25日星期日正午12:42:48”
使用方法:将下面的JS代码放到你想要显示的页面中(支持HTML页面),然后在你想要显示时间的位置插入下面的代码即可
<divid="Clock"align="center"style="font-size:12px;color:#000000"></div>
-------------------------
<script>
function tick() {
var hours, minutes, seconds, xfile;
var intHours, intMinutes, intSeconds;
var today, theday;
today = new Date();
function initArray(){
this.length=initArray.arguments.length
for(var i=0;i<this.length;i++)
this[i+1]=initArray.arguments[i] }
var d=new initArray(
"星期日",
"星期一",
"星期二",
"星期三",
"星期四",
"星期五",
"星期六");
theday = today.getYear()+"年" + [today.getMonth()+1]+"月" +today.getDate() + d[today.getDay()+1];
intHours = today.getHours();
intMinutes = today.getMinutes();
intSeconds = today.getSeconds();
if (intHours == 0) {
hours = "12:";
xfile = "午夜";
} else if (intHours < 12) {
hours = intHours+":";
xfile = "上午";
} else if (intHours == 12) {
hours = "12:";
xfile = "正午";
} else {
intHours = intHours - 12
hours = intHours + ":";
xfile = "下午";
}
if (intMinutes < 10) {
minutes = "0"+intMinutes+":";
} else {
minutes = intMinutes+":";
}
if (intSeconds < 10) {
seconds = "0"+intSeconds+" ";
} else {
seconds = intSeconds+" ";
}
timeString = theday+xfile+hours+minutes+seconds;
Clock.innerHTML = timeString;
window.setTimeout("tick();", 100);
}
window.onload = tick;
</script>
*************************************************************************
链接外部网络的时钟:
-------------------------------------------
<script src="http://www.clocklink.com/embed.js"></script><script type="text/javascript" language="JavaScript">obj = new Object;obj.clockfile = "5010-black.swf";obj.TimeZone = "CCT";obj.width = 222;obj.height = 66;obj.wmode = "transparent";showClock(obj);</script>
-------------------------------------------
<embed src="http://www.clocklink.com/clocks/5010-black.swf?TimeZone=CCT&" width="222" height="66" wmode="transparent" type="application/x-shockwave-flash">
************************************************************************
//////////////////////////////////////////////////////////////////////////////////////
实时走动的数字时钟
<script>
function tick() {
var hours, minutes, seconds, xfile;
var intHours, intMinutes, intSeconds;
var today;
today = new Date();
intHours = today.getHours();
intMinutes = today.getMinutes();
intSeconds = today.getSeconds();
if (intHours == 0) {
hours = "12:";
xfile = "午夜";
} else if (intHours < 12) {
hours = intHours+":";
xfile = "上午";
} else if (intHours == 12) {
hours = "12:";
xfile = "正午";
} else {
intHours = intHours - 12
hours = intHours + ":";
xfile = "下午";
}
if (intMinutes < 10) {
minutes = "0"+intMinutes+":";
} else {
minutes = intMinutes+":";
}
if (intSeconds < 10) {
seconds = "0"+intSeconds+" ";
} else {
seconds = intSeconds+" ";
}
timeString = xfile+hours+minutes+seconds;
Clock.innerHTML = timeString;
window.setTimeout("tick();", 100);
}
window.onload = tick;
</script>
第二步.将下面的代码加入html文件任意需要的地方
<div id="Clock" align="center" style="font-size: 20; color:#000000"></div>
你可以自行更改样式!
--------------------------------------
显示年月日格式的时间代码
<script language=javascript>
today=new Date();
function initArray(){
this.length=initArray.arguments.length
for(var i=0;i<this.length;i++)
this[i+1]=initArray.arguments[i] }
var d=new initArray(
"星期日",
"星期一",
"星期二",
"星期三",
"星期四",
"星期五",
"星期六");
document.write(
"<font color=##000000 style='font-size:9pt;font-family: 宋体'> ",
today.getYear(),"年",
today.getMonth()+1,"月",
today.getDate(),"日",
d[today.getDay()+1],
"</font>" );
</script>
-----------------------------------------
显示日期,星期,时间格式的代码
<script language="javascript">
<!---
today=new Date();
var hours = today.getHours();
var minutes = today.getMinutes();
var seconds = today.getSeconds();
var timevalue = "<FONT COLOR=black>" + ((hours >12) ? hours -12 :hours);
timevalue += ((minutes < 10) ? "<BLINK><FONT COLOR=black>:</FONT></BLINK>0" : "<BLINK><FONT COLOR=black>:</FONT></BLINK>") + minutes+"</FONT></FONT>";
timevalue += (hours >= 12) ? "<FONT COLOR=blue><I><B>pm</B></I></FONT>" : "<FONT COLOR=blue><B><I>am</I></B></FONT>";
function initArray()
{
this.length=initArray.arguments.length
for(var i=0;i<this.length;i++)
this[i+1]=initArray.arguments[i]
}
var d =new initArray("<font color=RED>星期日</font>","星期一 ","星期二","星期三","星期四","星期五","<font color=RED>星期六</font>");
document.write(today.getYear(),"年",today.getMonth()+1,"月",today.getDate(),"日",d[today.getDay()+1]," ",timevalue);
//-->
</script>
--------------------------------------
显示来访者的停留时间
<script language="javascript">
var ap_name = navigator.appName;
var ap_vinfo = navigator.appVersion;
var ap_ver = parseFloat(ap_vinfo.substring(0,ap_vinfo.indexOf('(')));
var time_start = new Date();
var clock_start = time_start.getTime();
var dl_ok=false;
function init ()
{
if(ap_name=="Netscape" && ap_ver>=3.0)
dl_ok=true;
return true;
}
function get_time_spent ()
{
var time_now = new Date();
return((time_now.getTime() - clock_start)/1000);
}
function show_secs () // show the time user spent on the side
{
var i_total_secs = Math.round(get_time_spent());
var i_secs_spent = i_total_secs % 60;
var i_mins_spent = Math.round((i_total_secs-30)/60);
var s_secs_spent = "" + ((i_secs_spent>9) ? i_secs_spent : "0" + i_secs_spent);
var s_mins_spent = "" + ((i_mins_spent>9) ? i_mins_spent : "0" + i_mins_spent);
document.fm0.time_spent.value = s_mins_spent + ":" + s_secs_spent;
window.setTimeout('show_secs()',1000);
}
</script>
<FORM name="fm0" onSubmit="0"><FONT COLOR="#6060FF">停留时间:
</FONT><INPUT type="text" name="time_spent" size=7 onFocus="this.blur()"></FORM>
第二步:在你主页源文件<body>中加入下面代码
<BODY onLoad="init(); window.setTimeout('show_secs()',1);">
----------------------------------
显示当前日期与时间的格式
<script language="javascript">
<!--
now = new Date()
hour = now.getHours()
if (hour < 12) {
document.write("现在是: " + now.toLocaleString())
} else if (hour < 18){
document.write("现在是: " + now.toLocaleString())
} else if (hour >= 18) {
document.write("现在是: " + now.toLocaleString())
}
// -->
</script>
-------------------------------
浏览器状态栏显示的时钟
<BODY onLoad="run(); timerONE=window.setTimeout"></BODY>
<SCRIPT LANGUAGE="javascript">
<!-- Hide
timeID = null;
timeRunning = false;
function stop () {
if(timeRunning)
clearTimeout(timeID);
timeRunning = false;
}
function time () {
tick = new Date();
hours = tick.getHours();
minutes = tick.getMinutes();
seconds = tick.getSeconds();
day = tick.getDay();
month = tick.getMonth();
date = tick.getDate();
year = tick.getYear();
current = "" + ((hours >12) ? hours -12 :hours)
current += ((minutes < 10) ? ":0" : ":") + minutes
current += ((seconds < 10) ? ":0" : ":") + seconds
current += (hours >= 12) ? " P.M." : " A.M."
if(day==0){var weekday = " 星期日"}
if(day==1){var weekday = " 星期一"}
if(day==2){var weekday = " 星期二"}
if(day==3){var weekday = " 星期三"}
if(day==4){var weekday = " 星期四"}
if(day==5){var weekday = " 星期五"}
if(day==6){var weekday = " 星期六"}
current +=(weekday)
window.status=current;
timeID = setTimeout("time()",1000);
timeRunning = true;
}
function run(){
stop();
time();
}
//-->
</SCRIPT>
------------------------------------------
显示最后更新时间代码
<SCRIPT language=javascript>
<!--hide script from old browsers
document.write("最后更新时间: " + document.lastModified + "")
// end hiding -->
</SCRIPT>
-----------------------------------------
根据不同的时间显示不同的问候语
方法:在主页中你需要的地方加入以下代码:
<script language="LiveScript">
now = new Date(),hour = now.getHours()
if(hour < 6){document.write("明天不用上班了吗?")}
else if (hour < 8){document.write("全新的一天!")}
else if (hour < 12){document.write("早安!")}
else if (hour < 14){document.write("外面太阳大吗?")}
else if (hour < 18){document.write("午安!")}
else if (hour < 22){document.write("晚上好!")}
else if (hour < 24){document.write("夜深了! 要注意身体呀! 祝你做个好梦!")}
</script>
说明,可以自行修改出更好更多的问候语!
-----------------------------------------
一个很酷的透明时钟代码
方法:在页面中你需要的地方加入下面的代码
<STYLE type=text/css>
BODY {COLOR: #000000; FONT-FAMILY: "宋体"; FONT-SIZE: 9pt; LINE-HEIGHT: 13pt}
TD {COLOR: #000000; FONT-FAMILY: "宋体"; FONT-SIZE: 9pt; LINE-HEIGHT: 13pt}
A:visited {COLOR: #000080;text-decoration:none}
a:link { text-decoration:none }
a:hover { text-decoration:underline }
.f12 {font-size:12px;}
.f13 {font-size:14.9px; LINE-HEIGHT: 120%}
.f24 {font-size:24px;LINE-HEIGHT: 120%}
.f14 {font-size:14.9px; LINE-HEIGHT: 170%}
</STYLE>
<script LANGUAGE="javascript">
Zp=670;
H='....';
H=H.split('');
M='.....';
M=M.split('');
S='......';
S=S.split('');
Yp=0;
Xp=0;
Yb=8;
Xb=8;
d_=12;
ns=(document.layers)?1:0;
fCol='222222';
sCol='ff0000';
mCol='0000ee';
hCol='green';
if (ns)
{
dgts='1 2 3 4 5 6 7 8 9 10 11 12';
dgts=dgts.split(' ');
for (i=0;i<d_;i++)
{document.write('<layer name=nsDigits'+i+' top=0 left=0 height=30 width=30><center><font face=Arial,Verdana size=1 color='+fCol+'>'+dgts[i]+'</font></center></layer>');}
for (i=0;i<M.length;i++)
{document.write('<layer name=ny'+i+' top=0 left=0 bgcolor='+mCol+' clip="0,0,2,2"></layer>');}
for (i=0;i<H.length;i++)
{document.write('<layer name=nz'+i+' top=0 left=0 bgcolor='+hCol+' clip="0,0,2,2"></layer>');}
for (i=0;i<S.length;i++)
{document.write('<layer name=nx'+i+' top=0 left=0 bgcolor='+sCol+' clip="0,0,2,2"></layer>');}
}
else
{
document.write('<div style="position:absolute;top:0px;left:0px"><div style="position:relative">');
for (i=1;i<d_+1;i++)
{
document.write('<div id="ieDigits" style="position:absolute;top:0px;left:0px;width:30px;height:30px;font-family:Arial,Verdana;font-size:10px;color:'+fCol+';text-align:center;padding-top:10px">'+i+'</div>');
}
document.write('</div></div>');
document.write('<div style="position:absolute;top:0px;left:0px"><div style="position:relative">');
for (i=0;i<M.length;i++)
{
document.write('<div id=y style="position:absolute;width:2px;height:2px;font-size:2px;background:'+mCol+'"></div>');
}
document.write('</div></div>');
document.write('</div></div>');
document.write('<div style="position:absolute;top:0px;left:0px"><div style="position:relative">');
for (i=0;i<H.length;i++)
{document.write('<div id=z style="position:absolute;width:2px;height:2px;font-size:2px;background:'+hCol+'"></div>');}
document.write('</div></div>');
document.write('<div style="position:absolute;top:0px;left:0px"><div style="position:relative">');
for (i=0;i<S.length;i++)
{document.write('<div id=x style="position:absolute;width:2px;height:2px;font-size:2px;background:'+sCol+'"></div>');}
document.write('</div></div>');
}
function clock()
{
time=new Date ();
secs=time.getSeconds();
sec=-1.57+Math.PI*secs/30;
mins=time.getMinutes();
min=-1.57+Math.PI*mins/30;
hr=time.getHours();
hrs=-1.57+Math.PI*hr/6+Math.PI*parseInt(time.getMinutes())/360;
if (ns)
{
Yp=window.pageYOffset+window.innerHeight-60;Xp=80;
}
else
{
Yp=document.body.scrollTop+window.document.body.clientHeight-60;
Xp=document.body.scrollLeft+60;
}
if (ns)
{
for (i=0;i<d_;++i)
{
document.layers["nsDigits"+i].top=Yp-5+40*Math.sin(-0.49+d_+i/1.9);
document.layers["nsDigits"+i].left=Xp-15+40*Math.cos(-0.49+d_+i/1.9);
}
for (i=0;i<S.length;i++)
{
document.layers["nx"+i].top=Yp+i*Yb*Math.sin(sec);
document.layers["nx"+i].left=Xp+i*Xb*Math.cos(sec);
}
for (i=0;i<M.length;i++)
{
document.layers["ny"+i].top=Yp+i*Yb*Math.sin(min);
document.layers["ny"+i].left=Xp+i*Xb*Math.cos(min);
}
for (i=0;i<H.length;i++)
{
document.layers["nz"+i].top=Yp+i*Yb*Math.sin(hrs);
document.layers["nz"+i].left=Xp+i*Xb*Math.cos(hrs);
}
}
else
{
for (i=0;i<d_;++i)
{
ieDigits[i].style.pixelTop=Yp-15+40*Math.sin(-0.49+d_+i/1.9);
ieDigits[i].style.pixelLeft=Xp-14+40*Math.cos(-0.49+d_+i/1.9)+Zp;
}
for (i=0;i<S.length;i++)
{
x[i].style.pixelTop=Yp+i*Yb*Math.sin(sec);
x[i].style.pixelLeft=Xp+i*Xb*Math.cos(sec)+Zp;
}
for (i=0;i<M.length;i++)
{
y[i].style.pixelTop=Yp+i*Yb*Math.sin(min);
y[i].style.pixelLeft=Xp+i*Xb*Math.cos(min)+Zp;
}
for (i=0;i<H.length;i++)
{
z[i].style.pixelTop=Yp+i*Yb*Math.sin(hrs);
z[i].style.pixelLeft=Xp+i*Xb*Math.cos(hrs)+Zp;
}
}
setTimeout('clock()', 50);
}
if (document.layers || document.all) {window.onload=clock;}
window.onload=clock;
</script>
********************************************************************
//////////////////////////////////////////////////////////////////////////////////////
分享到:
相关推荐
GUI API包含的类分为三个部分:组件类(component class) 容器类(container class),和辅助类(helper class) 1. 组件类是用来创建用户图形界面的,例如JButton,JLabel,JTextField. 2. 容器类是用来包含其他组件的,例如JFrame,JPanel 3. 辅助类是用来支持GUI组件的,例如Color,Font
汉诺塔c语言递归
mybatis-plus-core.jar 各个版本,免费下载, mybatis-plus-core.jar 是 MyBatis 的增强工具核心包。免费下载 。 MyBatis-Plus(简称 MP),是一个 MyBatis 的增强工具包,只做增强不做改变,为简化开发工作、提高生产率而生。
mybatis-plus-generato.jar 包,各个版本,免费下载。 mybatis-plus 代码生成器生成代码框架。各个版本,免费下载。 下载不了,关注我,评论区联系我。
行业研究
stm32项目知识领域: 网络安全 技术关键词: 漏洞分析、渗透测试、加密算法 内容关键词: 攻击防范、身份验证、网络流量分析 用途: 学习保护信息系统免受恶意攻击和数据泄露 资源描述: "OWASP官方网站"提供了全面的网络安全知识和工具,包括常见漏洞、安全指南和最佳实践。
mybatis-plus-core.jar 各个版本,免费下载, mybatis-plus-core.jar 是 MyBatis 的增强工具核心包。免费下载 。 MyBatis-Plus(简称 MP),是一个 MyBatis 的增强工具包,只做增强不做改变,为简化开发工作、提高生产率而生。
测试YUV图像数据的具体格式(1).zip
多思计算机组成原理实验三 存储器实验.docx
行业分析报告
st-stm32cubeide_1.15.0_20695_20240315_1429_x86_64
调节篮球比赛定时器,毕业设计实验报告,multisim仿真,AD09原理图及PCB图
halcon缺陷检测
JSP 标准标签库(JSP Standard Tag Library,JSTL)是一个实现 Web 应用程序中常见的通用功能的定制标记库集,这些功能包括迭代和条件判断、数据管理格式化、XML 操作以及数据库访问. 如果要使用JSTL,则必须将standard-1.1.2.jar和 jstl-1.2.jar文件放到classpath中
本文深入探讨了微电网多目标调度问题,提出了一种改进的多目标粒子群算法(MOPSO),以实现微电网系统在经济性、可靠性和环境影响等多个目标函数之间的优化平衡。文章详细介绍了算法的改进机制,并通过案例分析展示了其在实际微电网调度中的应用效果。本研究适用于电力系统工程师、能源管理专业人士以及对智能电网和优化算法感兴趣的学者。使用场景包括微电网的规划、运行和维护,特别是在考虑经济性和环境因素时的系统优化。 关键词 微电网
视频批量剪辑,亲测可用,操作简单,视频创作者福音
行业分析报告
易学是一套针对学校借书的多角色图书管理系统,分为读者与管理员。 管理员可对图书进行管理、发布通知公告、管理图书借阅、图书归还等操作。 读者可对图书进行查询、借阅等,可查看公告信息以及自己的借阅记录。 本系统采用前后端分离架构,后台采用Springboot+Mybatis,前端开用VUE+ElementUI。 涉及技术均为当前比较新进技术架构,难度适中,非常适合作为设计或学习使用。
中英文的20套简历模板
springboot线上买菜系统 项目关键技术 开发工具:IDEA 、Eclipse 编程语言: Java 数据库: MySQL5.7+ 框架:ssm、Springboot 前端:Vue、ElementUI 关键技术:springboot、SSM、vue、MYSQL、MAVEN 数据库工具:Navicat、SQLyog