documenttitle.html

来自「Javascript中最常用的55个经典技巧.doc」· HTML 代码 · 共 32 行

HTML
32
字号
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Javascript实例</title>
<script language="javascript" type="text/javascript">
<!--
function GetTime()
{
    var now=new Date();
    var years,months,days,hours,minutes,seconds,myTime;
    years=now.getFullYear();
    months=now.getMonth()+1;
    days=now.getDate();
    hours=now.getHours();
    minutes=now.getMinutes();
    seconds=now.getSeconds();
    
    myTime=years+"年"+months+"月"+days+"日 "+hours+":"+minutes+":"+seconds;
    
    document.title=myTime;
    window.status=myTime;
    var timer1=setTimeout("GetTime()",1000);
}
//-->
</script>
</head>

<body onload="GetTime();">
</body>
</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?