Dreamweaver中怎样添加显示时间日期
发布网友
发布时间:2022-05-02 10:49
我来回答
共4个回答
热心网友
时间:2022-06-19 11:50
你好,其实这个问题我回答过的,你复制我的代码到dw运行下就有了:<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>网页特效</title></head><body onload=startclock()><form name="clock">
<script language="JavaScript">
var timerID = null;
var timerRunning = false;
function stopclock (){
if(timerRunning)
clearTimeout(timerID);
timerRunning = false;}
function startclock () {
stopclock();
showtime();}
function showtime () {
var now = new Date();
var hours = now.getHours();
var minutes = now.getMinutes();
var seconds = now.getSeconds()
var timeValue = now.getYear()+"年"+(now.getMonth()+1)+"月"+now.getDate()+"日" +((hours >= 12) ? " 下午 " : " 上午 " )
timeValue += ((hours >12) ? hours -12 :hours)
timeValue += ((minutes < 10) ? ":0" : ":") + minutes
timeValue += ((seconds < 10) ? ":0" : ":") + seconds
document.clock.thetime.value = timeValue;
timerID = setTimeout("showtime()",1000);
timerRunning = true;}
</script>
<input name="thetime" style="font-size: 9pt;color:#000000;border:1px solid #FFFFFF; ; " size="28"></form>
</body>
</html>
热心网友
时间:2022-06-19 11:50
用以下JS代码即可<script language="javascript">
<!--
today=new Date();
var week; var date;
if(today.getDay()==0) week="星期日"
if(today.getDay()==1) week="星期一"
if(today.getDay()==2) week="星期二"
if(today.getDay()==3) week="星期三"
if(today.getDay()==4) week="星期四"
if(today.getDay()==5) week="星期五"
if(today.getDay()==6) week="星期六"
date=(today.getYear())+"年"+(today.getMonth()+1)+"月"+today.getDate()+"日"+" "
document.write(date+week);
// -->
</script>
热心网友
时间:2022-06-19 11:51
<div id="time">//放置时间的层 <script language="javascript" type="text/javascript"> var time=new Date();
var year=time.getFullYear();
var month=time.getMonth()+1;
var date=time.getDate();
var day=time.getDay();
switch(day)
{
case 0:
day1="星期日";
break;
case 1:
day1="星期一";
break;
case 2:
day1="星期二";
break;
case 3:
day1="星期三";
break;
case 4:
day1="星期四";
break;
case 5:
day1="星期五";
break;
case 6:
day1="星期六";
break;
}
document.write("今天是:"+year+"年"+month+"月"+date+"日"+day1);
</script></div>
</div>
热心网友
时间:2022-06-19 11:51
在插入菜单栏里,有个日期选项