<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 40 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>
<BODY>
<SCRIPT language=JavaScript>
function Year_Month(){
var now = new Date();
var yy = nowgetYear();
var mm = nowgetMonth()+1;
var cl = '<font color="#333333">';
if (nowgetDay() == 0) cl = '<font color="#333333">';
if (nowgetDay() == 6) cl = '<font color="#333333">';
return(cl + yy + '年' + mm + '月</font>'); }
function Date_of_Today(){
var now = new Date();
var cl = '<font color="#ff0000">';
if (nowgetDay() == 0) cl = '<font color="#333333">';
if (nowgetDay() == 6) cl = '<font color="#333333">';
return(cl + nowgetDate() + '</font>'); }
function Day_of_Today(){
var day = new Array();
day[0] = "星期日";
day[1] = "星期一";
day[2] = "星期二";
day[3] = "星期三";
day[4] = "星期四";
day[5] = "星期五";
day[6] = "星期六";
var now = new Date();
var cl = '<font color="#333333">';
if (nowgetDay() == 0) cl = '<font color="#333333">';
if (nowgetDay() == 6) cl = '<font color="#333333">';
return(cl + day[nowgetDay()] + '</font>'); }
function CurentTime(){
var now = new Date();
var hh = nowgetHours();
var mm = nowgetMinutes();
var ss = nowgetTime() % 60000;
ss = (ss - (ss % 1000)) / 1000;
var clock = hh+':';
if (mm < 10) clock += '0';
clock += mm+':';
if (ss < 10) clock += '0';
clock += ss;
return(clock); }
function refreshCalendarClock(){
documentallcalendarClock1innerHTML = Year_Month();
documentallcalendarClock2innerHTML = Date_of_Today();
documentallcalendarClock3innerHTML = Day_of_Today();
documentallcalendarClock4innerHTML = CurentTime(); }
var webUrl = webUrl;
documentwrite('<table border="0" cellpadding="0" cellspacing="0"><tr><td>');
documentwrite('<table id="CalendarClockFreeCode" border="0" cellpadding="0" cellspacing="0" width="60" height="70" ');
documentwrite('style="position:absolute;visibility:hidden" bgcolor="#eeeeee">');
documentwrite('<tr><td align="center"><font ');
documentwrite('style="cursor:hand;color:#ff0000;font-family:宋体;font-size:14pt;line-height:120%" ');
if (webUrl != 'netflower'){
documentwrite('</td></tr><tr><td align="center"><font ');
documentwrite('style="cursor:hand;color:#2000ff;font-family:宋体;font-size:9pt;line-height:110%" ');
}
documentwrite('</td></tr></table>');
documentwrite('<table border="0" cellpadding="0" cellspacing="0" width="61" height="70">');
documentwrite('<tr><td valign="top" width="100%" height="100%">');
documentwrite('<table border="0" cellpadding="0" cellspacing="0" width="58" height="67">');
documentwrite('<tr><td align="center" width="100%" height="100%" >');
documentwrite('<font id="calendarClock1" style="font-family:宋体;font-size:9pt;line-height:120%"> </font><br>');
documentwrite('<font id="calendarClock2" style="color:#333333;font-family:Arial;font-size:14pt;line-height:120%"> </font><br>');
documentwrite('<font id="calendarClock3" style="color:#333333;font-family:宋体;font-size:9pt;line-height:120%"> </font><br>');
documentwrite('<font id="calendarClock4" style="color:#333333;font-family:宋体;font-size:9pt;line-height:120%"><b> </b></font>');
documentwrite('</td></tr></table>');
documentwrite('</td></tr></table>');
documentwrite('</td></tr></table>');
setInterval('refreshCalendarClock()',1000);
</SCRIPT>
</BODY>
</HTML>
<script>
var d= new Date("2014-10-10");//这里日期是传递过来的,可以自己改
dsetDate(dgetDate() + 10);//天数+10
var nd=dgetFullYear()+"-"+(dgetMonth()+1)+"-"+dgetDate();//新日期
alert(nd);
</script>
var date = new Data();
var year = dategetFullYear()
还有其他的一些获取年月日、时分秒、星期等的可以参考Date 对象方法
以上就是关于JS代码获取日期时间的网页全部的内容,包括:JS代码获取日期时间的网页、js获取文本框的日期,并且进行加减,以得到另一个日期、JS怎么将日期的值转换为字符串格式,分别获取年份等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)