css+div设置日期时间代码

html-css013

css+div设置日期时间代码,第1张

<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>

按我的来 保证没有问题 不用写什么margin移位这种来画蛇添足了

浏览器全面兼容

我发现你的页面在firefox有移位哦 注意标准写法

<!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>

<meta http-equiv="Content-Type" content="text/htmlcharset=utf-8" />

<title>无标题文档</title>

<style>

ul li {

margin:0

padding:0

width:500px

line-height:25px

}

a {

color:#000

}

a:hover {

color:#666

}

li a {

width:800px

background:#f00

display:inline-block

}

li a span {

width:400px

background:#0f0

display:inline-block

float:left

}

li a span.l {

width:200px

background:#0f0

display:inline-block

float:right

}

</style>

</head>

<body>

<div style="height:700px"><img src="3.10湖南检察院.jpg" width="300" height="300" style="float:left"/>

<ul style="list-style:nonepadding:0margin:0width:500pxheight:500pxfloat:leftmargin-left:20px">

<li><a href="#"><span>奥巴马就职后对中国持敌对态度,中国高层很懊恼!</span><span class="l">2009-08-08</span></a></li>

<li><a href="#"><span>奥巴马就职后对中国持敌对态度,中国高层很懊恼!</span><span class="l">2009-08-08</span></a></li>

<li><a href="#"><span>奥巴马就职后对中国持敌对态度,中国高层很懊恼!</span><span class="l">2009-08-08</span></a></li>

<li><a href="#"><span>奥巴马就职后对中国持敌对态度,中国高层很懊恼!</span><span class="l">2009-08-08</span></a></li>

<li><a href="#"><span>奥巴马就职后对中国持敌对态度,中国高层很懊恼!</span><span class="l">2009-08-08</span></a></li>

</ul>

</div>

</body>

</html>

日历和时间代码:(加在空白处)

#header div.lc{background:url(http://danjo.ca/cgi-sys/Count.cgi?display=date&dformat=yymmdd&ft=0&dd=cd&timezone=GMT+0800) no-repeat 95% 30% !importantfilter:Chroma(Color="#EE0000")DropShadow(Color=gray, OffX=3, OffY=3, Positive=true) !important}/*日期*/

#header div.rc{background:url(http://danjo.ca/cgi-sys/Count.cgi?display=clock&tformat=24&ft=0&dd=cd&timezone=GMT+0800) no-repeat 95% 60%}

.stage{background:url() } /*时间*/