css样式日期,css样式说明
css中如何显示时间年月日 星期几 几点几分几秒
html
创新互联是一家专注于成都网站建设、网站制作与策划设计,盖州网站建设哪家好?创新互联做网站,专注于网站建设十载,网设计领域的专业建站公司;建站业务涵盖:盖州等地区。盖州做网站价格咨询:18982081108
head
meta http-equiv="Content-Type" content="text/html; charset=gb2312"
meta name="keywords" content="js特效" /
meta name="description" content="js特效网" /
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
完成所示网页,使用表格布局,使用CSS控制样式,表格第一行日期是使用JS显示的系统当前日期。
!DOCTYPE html
html lang="en"
head
meta charset="UTF-8"
titleDocument/title
style
*{margin:0;padding:0;}
.tdemo{width: 600px;height: 400px;margin:100px auto;}
.ttitle{background:#dfdfdf;height:50px;text-align:center;}
.tcontent{background:#eee;height:300px;}
.cnt{padding:20px 25px;}
.cnt p{line-height:25px;font-size:15px;color:#222;}
.tcontent h6{text-indent:25px;font-size:16px;color:#111;}
.tcontent p.last{text-indent:25px;}
.tfoot{background:#aaa;height:50px;}
.tfoot button{width: 60px;height: 28px;float: right;margin-right: 30px;}
/style
/head
body
table class="tdemo"
tr class="ttitle"
td
span id="time"/span
/td
/tr
tr class="tcontent"
td
h6谜面:/h6
div class="cnt"
p1.一只羊在吃草,一只狼从旁边经过没有吃羊。/p
p2.又一只狼经过,还是没有吃羊。/p
p3.第三只狼经过,羊冲狼大叫,狼还是没有吃羊。/p
/div
p class="last"打:三种动物/p
/td
/tr
tr class="tfoot"
td
button查看谜底/button
/td
/tr
/table
script
var showzone=document.getElementById("time");
var time=new Date();
var yy=time.getFullYear();
var mm=time.getMonth()+1;
var dd=time.getDate();
var kk=time.getDay();
var xingqi;
if(kk==0){
k="星期天"
}
else if(kk==1){
xingqi="星期一";
}
else if(kk==2){
xingqi="星期二"
}
else if(kk==3){
xingqi="星期三"
}
else if(kk==4){
xingqi="星期四"
}
else if(kk==5){
xingqi="星期五"
}
else{
xingqi="星期六";
}
showzone.innerHTML="今天是:"+yy+"年"+mm+"月"+dd+"日"+xingqi+" ---欢迎你来猜一猜";
/script
/body
/html
谁帮我修改下CSS样式中的时间排列
diva href="#" style="float:left; text-align:left; margin-left:10px;"文字列表内容/aspan style="clear:both;float:right; margin-right:20px;"时间/span/div
至于时间不显示年,要改js代码,一般是把年份隐藏,有是系统时间,要代码控制的。
css+div设置日期时间代码
td width="23%" align="left"今天是:
script language="JavaScript" type="text/javascript"
var day="";
var month="";
var ampm="";
var ampmhour="";
var myweekday="";
var year="";
mydate=new Date();
myweekday=mydate.getDay();
mymonth=mydate.getMonth()+1;
myday= mydate.getDate();
myyear= mydate.getYear();
year=(myyear 200) ? myyear : 1900 + myyear;
if(myweekday == 0)
weekday=" 星期日 ";
else if(myweekday == 1)
weekday=" 星期一 ";
else if(myweekday == 2)
weekday=" 星期二 ";
else if(myweekday == 3)
weekday=" 星期三 ";
else if(myweekday == 4)
weekday=" 星期四 ";
else if(myweekday == 5)
weekday=" 星期五 ";
else if(myweekday == 6)
weekday=" 星期六 ";
document.write(year+"年"+mymonth+"月"+myday+"日 "+weekday);/script/td
当前标题:css样式日期,css样式说明
本文网址:http://ybzwz.com/article/dsgccph.html