足球游戏_中国足彩网¥体育资讯$

极品日历代码
来源:易贤网 阅读:931 次 日期:2016-06-22 09:44:29
温馨提示:易贤网小编为您整理了“极品日历代码”,方便广大网友查阅!

查看效果:日历效果

<script>

var myc_x,myc_y;

var myc_timeset=null,myc_timeset1=null;

var divobj=null;

var inputname;

function mycalendar() //构建对象

{

var mydate = new date();

this.year = mydate.getfullyear();

this.month = mydate.getmonth()+1;

this.date = mydate.getdate();

this.format=yyyy-mm-dd;

this.style = mystyle(1); 

this.show = createcalendar;

this.input = createinput;

}

function mystyle(num) //设置样式

{

if(!num||isnan(num)){alert('参数不对,采用默认样式!');num=1;}

var style = new array();

style[1]=.week{background-color:#dfdfff;font-size:12px;width:140px;}

+.ds{width:140px;font-size:12px;cursor:hand}

+.mover{border:1px solid black;background-color:#f4f4f4;}

+.move1{border:1px solid #5d5d5d;background-color:#f4f4f4;color:#909eff;font-size:12px}

+.tit{background-color:#909eff;width:140px;font-size:12px;color:white;cursor:default}

+.cs{position:absolute;border:1px solid #909eff;width:142px;left:0px;top:0px;z-index:9999;}

+.shadow{position:absolute;left:0px;top:0px;font-family: arial black;font-size:50px;color:#d4d4d4;z-index:1;text-align:center;};

document.write(<style type='text/css'>);

document.write(style[num]);

document.write(</style>);

}

function createcalendar()

{

var week = new array('日','一','二','三','四','五','六');

document.write(<div class='cs' onselectstart='return false' oncontextmenu='return false' onmousedown='if(event.button==2)this.style.display=\none\' id='myc_div'><div class='shadow'></div><div style='position:absolute;left:0px;top:0px;z-index:1'>);

//创建头部

document.write(<table class='tit' id='myc_top' onmousedown='myc_x=event.x-parentnode.parentnode.style.pixelleft;myc_y=event.y-parentnode.parentnode.style.pixeltop;setcapture()' onmouseup='releasecapture();' onmousemove='mycmove(this.parentelement.parentelement);'><tr><td width=10 onmouseover='this.style.color=\black\' onmouseout='this.style.color=\\' onclick='cutyear()' style='font-family: webdings;cursor:hand;' title='减少年份'>7</td><td title='减少月份' onmouseover='this.style.color=\black\' onclick='cutmonth()' onmouseout='this.style.color=\\' width=10 style='font-family: webdings;cursor:hand;'>3</td><td align=center onmouseover=this.classname='move1'; onmouseout=this.classname='';divhidden(myc.parentelement.nextsibling); onclick='createyear(+this.year+,this);divshow(myc.parentelement.nextsibling);'></td><td align=center onclick='createmonth(+this.month+,this);divshow(myc.parentelement.nextsibling)' onmouseover=this.classname='move1'; onmouseout=this.classname='';divhidden(myc.parentelement.nextsibling);></td><td width=10 onmouseover='this.style.color=\black\' onmouseout='this.style.color=\\' onclick='addmonth()' style='font-family: webdings;cursor:hand;' title='增加月份'>4</td><td width=10 style='font-family: webdings;cursor:hand;' onmouseover='this.style.color=\black\' onmouseout='this.style.color=\\' onclick='addyear()' title='增加年份'>8</td></tr></table>);

//创建星期条目

document.write(<table class='week'><tr>);

for(i=0;i<7;i++)

document.write(<td align=center>+week[i]+</td>);

document.write(</tr></table>);

//创建日期条目

document.write(<table class='ds' id='myc' cellspacing=2 cellpadding=0>);

for(i=0;i<6;i++)

{

document.write(<tr>);

for(j=0;j<7;j++)

document.write(<td width=10% height=16 align=center onmouseover='mover(this)' onmouseout='mout(this)' onclick='if(this.innertext!=\\)getvalue(inputname,this.innertext);myc_div.style.display=\none\'></td>);

document.write(</tr>);

}

document.write(</table>);

//建建水印

document.write(</div>);

//创建选择图层

document.write(<div style='position:absolute;left:0px;top:0px;z-index:3' onmouseover=divshow(this) onmouseout=divhidden(this)></div>);

document.write(</div>);

//显示日期

showdate(this.year,this.month);

myc_div.style.display='none';

}

function getvalue(obj,value)

{

eval(obj).value=parseint(myc_top.cells[2].innertext)+-+parseint(myc_top.cells[3].innertext)+-+value;

}

function showdate(year,month)

{

var mydate = new date(year,month-1,1);

var today = new date();

var day = mydate.getday();

var length = new array(31,30,31,30,31,30,31,31,30,31,30,31);

length[1] = ((year%4==0)&&(year%100!=0)||(year%400==0))?29:28;

for(i=0;i<myc.cells.length;i++)myc.cells[i].innerhtml = ;

for(i=0;i<length[month-1];i++)

{

myc.cells[i+day].innerhtml = (i+1);

if(new date(year,month-1,i+1).getday()==6||new date(year,month-1,i+1).getday()==0){myc.cells[i+day].style.color='red';}

}

myc_top.cells[2].innertext=year+年;

myc_top.cells[3].innertext=month+月;

with(myc.parentnode.previoussibling.style)

{

pixelleft=myc.offsetleft;

pixeltop=myc.offsettop;

height = myc.clientheight;

width = myc.clientwidth;

}

myc.parentelement.parentelement.style.height=myc.parentelement.offsetheight;

myc.parentelement.previoussibling.innerhtml=year;

}

//一些附加函数--------------------

//---------begin-------------------

function mover(obj){obj.classname = 'mover';}

function mout(obj){if(obj.classname=='mover')obj.classname = '';}

function addyear(){var year = parseint(myc_top.cells[2].innertext);var month = parseint(myc_top.cells[3].innertext); year++;showdate(year,month);}

function addmonth(){var year = parseint(myc_top.cells[2].innertext);var month = parseint(myc_top.cells[3].innertext);month++;if(month>12){month=1;year++;}showdate(year,month);}

function cutyear(){var year = parseint(myc_top.cells[2].innertext);var month = parseint(myc_top.cells[3].innertext);year--;showdate(year,month);}

function cutmonth(){var year = parseint(myc_top.cells[2].innertext);var month = parseint(myc_top.cells[3].innertext);month--;if(month<1){month=12;year--;}showdate(year,month);}

function divs(obj)

{

if(obj!=divobj)

{

obj.style.backgroundcolor=#909eff;

obj.style.color='black';

}

if(divobj!=null)

{

divobj.style.backgroundcolor='';

divobj.style.color='';

}

divobj = obj;

}

function divshow(obj)

{ if (myc_timeset!=null) cleartimeout(myc_timeset);

obj.style.display='block';

}

function divhidden(obj){myc_timeset=window.settimeout(function(){obj.style.display='none'},500);}

function createyear(year,obj)//创建年份选择

{

var ystr;

var odiv;

ystr=<table class='move1' cellspacing=0 cellpadding=2 width=+obj.offsetwidth+>;

ystr+=<tr><td style='cursor:hand' onclick='createyear(+(year-20)+,myc_top.cells[2])' align=center>上翻</td></tr>;

for(i=year-10;i<year+10;i++)

if(year==i)

ystr+=<tr style='background-color:#909eff'><td style='color:black;height:16px;cursor:hand' align=center onclick='myc_top.cells[2].innertext=this.innertext;showdate(+i+,parseint(myc_top.cells[3].innertext));myc.parentelement.nextsibling.innerhtml=\\'>+i+年</td></tr>;

else

ystr+=<tr><td align=center style='cursor:hand' onmouseover=divs(this) onclick='myc_top.cells[2].innertext=this.innertext;showdate(+i+,parseint(myc_top.cells[3].innertext));myc.parentelement.nextsibling.innerhtml=\\'>+i+年</td></tr>;

ystr+=<tr><td style='cursor:hand' onclick='createyear(+(year+20)+,myc_top.cells[2])' align=center>下翻</td></tr>;

ystr+=</table>;

odiv = myc.parentelement.nextsibling;

odiv.innerhtml='';

odiv.innerhtml = ystr;

showdiv(odiv,obj.offsettop+obj.offsetheight,obj.offsetleft);

}

function createmonth(month,obj)//创建月份选择

{

var mstr;

var odiv;

mstr=<table class='move1' cellspacing=0 cellpadding=2 width=+obj.offsetwidth+>;

for(i=1;i<13;i++)

if (month==i)

mstr+=<tr style='background-color:#909eff'><td style='color:black;height:16px;cursor:hand' align=center onclick='myc_top.cells[3].innertext=this.innertext;showdate(parseint(myc_top.cells[2].innertext),+i+);myc.parentelement.nextsibling.innerhtml=\\'>+i+月</td></tr>;

else

mstr+=<tr><td align=center style='cursor:hand' onmouseover='divs(this)' onclick='myc_top.cells[3].innertext=this.innertext;showdate(parseint(myc_top.cells[2].innertext),+i+);myc.parentelement.nextsibling.innerhtml=\\'>+i+月</td></tr>;

mstr+=</table>;

odiv = myc.parentelement.nextsibling;

odiv.innerhtml='';

odiv.innerhtml = mstr;

showdiv(odiv,obj.offsettop+obj.offsetheight,obj.offsetleft);

}

function showdiv(obj,top,left)

{

obj.style.pixeltop=top;

obj.style.pixelleft=left;

}

function mycmove(obj)

{

if(event.button==1)

{

var x = obj.clientleft;

var y = obj.clienttop;

obj.style.pixelleft= x+(event.x-myc_x);

obj.style.pixeltop= y+(event.y-myc_y);

window.status=myc_y;

}

}

function showdiv2(obj)

{

inputname=obj.name;

var e=obj;

var ot = obj.offsettop;

var ol=obj.offsetleft;

while(obj=obj.parentelement){ot+=obj.offsettop;ol+=obj.offsetleft;}

myc_div.style.pixeltop=ot+e.offsetheight;

myc_div.style.pixelleft=ol;

myc_div.style.display=block;

}

function createinput(name)

{myc_div.style.display='none';

document.write(<input type='text' name='+name+' size=20 onfocus='showdiv2(this)'>);

}

// --------------end ---------------------

</script>

<script>

var mycalendar=new mycalendar;

mycalendar.year=2005;

mycalendar.show();

mycalendar.input(txt1);

</script>

<input type=text name=test onfocus=showdiv2(this) readonly=true>

中国足彩网信息请查看脚本栏目
上一篇:js的优点
易贤网手机网站地址:极品日历代码
由于各方面情况的不断调整与变化,易贤网提供的所有考试信息和咨询回复仅供参考,敬请考生以权威部门公布的正式信息和咨询为准!

2025国考·省考课程试听报名

  • 报班类型
  • 姓名
  • 手机号
  • 验证码
关于我们 | 联系我们 | 人才招聘 | 网站声明 | 网站帮助 | 非正式的简要咨询 | 简要咨询须知 | 加入群交流 | 手机站点 | 投诉建议
工业和信息化部备案号:滇ICP备2023014141号-1 足球游戏_中国足彩网¥体育资讯$ 滇公网安备53010202001879号 人力资源服务许可证:(云)人服证字(2023)第0102001523号
云南网警备案专用图标
联系电话:0871-65099533/13759567129 获取招聘考试信息及咨询关注公众号:hfpxwx
咨询QQ:526150442(9:00—18:00)版权所有:易贤网
云南网警报警专用图标