我的第一个JS/CSS程序
2015-10-21 12:48
567 查看
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<!--<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />-->
<title>无标题文档</title>
<script>
function displayTime() {
var elt = document.getElementById("clock");
var now = new Date();
//elt.innerHTML = now.toLocalTimeString();
elt.innerHTML = now.toLocaleString();
setTimeout(displayTime,1000);
}
window.onload=displayTime;
</script>
<style>
#clock {
font: bold 24pt sans;
background: #ddf;
padding: 10px;
border: solid black 2px;
border-radius: 10px;
}
</style>
</head>
<body>
<h1>Digital Clock</h1>
<span id="clock"></span>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<!--<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />-->
<title>无标题文档</title>
<script>
function displayTime() {
var elt = document.getElementById("clock");
var now = new Date();
//elt.innerHTML = now.toLocalTimeString();
elt.innerHTML = now.toLocaleString();
setTimeout(displayTime,1000);
}
window.onload=displayTime;
</script>
<style>
#clock {
font: bold 24pt sans;
background: #ddf;
padding: 10px;
border: solid black 2px;
border-radius: 10px;
}
</style>
</head>
<body>
<h1>Digital Clock</h1>
<span id="clock"></span>
</body>
</html>