标签“js动态时间”下的文章

怎么用JS实现动态时钟效果

<!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>
<title>JS的动态时间效果 </title>
<meta http-equiv=”Content-Type” content=”text/html; charset=gbk” />
<meta name=”generator” content=”editplus” />
<meta name=”author” content=”fanglor” />
<meta name=”keywords” content=”js时钟,js动态时间,js时钟效果” />
<meta name=”description” content=”一个用JS实现的时时变化的动态时钟效果” />
</head>

<body>
<span id=”time”></span>
<script language=”javascript” type=”text/javascript”>
window.onload=function (){
setInterval(“document.getElementById(‘time’).innerHTML=new Date().toLocaleString()+’ 星期’+'日一二三四五六’.charAt(new Date().getDay());”,1000);
}
</script>

</body>
</html>