📄 2.txt
字号:
例子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>
上面这个在低版本浏览器里看不见
例子2:
<script language="JavaScript"><!--
var enabled = 0; today = new Date();
var day; var date;
if(today.getDay()==0) day = "星期日"
if(today.getDay()==1) day = "星期一"
if(today.getDay()==2) day = "星期二"
if(today.getDay()==3) day = "星期三"
if(today.getDay()==4) day = "星期四"
if(today.getDay()==5) day = "星期五"
if(today.getDay()==6) day = "星期六"
document.fgColor = "000000";
date = " 今天是 " + (today.getYear()) + " 年" + (today.getMonth() + 1 ) + " 月 " + today.getDate() + " 日 " + day +"";
document.write("<CENTER><TABLE BORDER=2 BGCOLOR=000000><TH><FONT COLOR=ffffff>")
document.write("<CENTER>" + date.fontsize(3) + "</CENTER>");
document.write("</FONT></TH></TABLE></center><P>")// -->
</script>
例子3:
<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 color=black>星期一","<font color=black>星期二","<font color=black>星期三","<font color=black>星期四","<font color=black>星期五","<font color=GREEN>星期六"); document.write("<font color=black>19<font color=black>",today.getYear(),"<font color=red>年","<font color=black>",today.getMonth()+1,"<font color=red>月","<font color=black>",today.getDate(),"<font color=red>日 </FONT>",d[today.getDay()+1]," ",timeValue); //--></script>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -