爱吧音乐花园's Archiver

花香凝露 发表于 2006-11-20 14:46

日期选择代码

[code]<script language=javascript>
var DS_x,DS_y;

function dateSelector()
{
  var myDate=new Date();
  this.year=myDate.getFullYear();
  this.month=myDate.getMonth()+1;
  this.date=myDate.getDate();
  this.inputName='';
  this.inputClass='';
  this.display=display;
}

function display()
{
  var week=new Array('日','一','二','三','四','五','六');

  document.write("<style type=text/css>");
  document.write("  .ds_font td,span  { font: normal 12px Arial, Helvetica, sans-serif; color: #000000; }");
  document.write("  .ds_border  { border: 1px solid #000000; cursor: hand; background-color: #DDDDDD }");
  document.write("  .ds_border2  { border: 1px solid #000000; cursor: hand; background-color: #DDDDDD }");
  document.write("</style>");

  document.write("<input style='width:70px;' size=10 id='DS_"+this.inputName+"' class='"+this.inputClass+"' name='"+this.inputName+"' value='"+this.year+"-"+this.month+"-"+this.date+"' onblur='this.readOnly=true' readonly>");
  document.write("<button style='width:60px;height:18px;padding-top:0px;font-size:12px;margin:1px;border:1px solid #A4B3C8;background-color:#DFE7EF;position : absolute;' type=button onclick=this.nextSibling.style.display='block' onfocus=this.blur()>选择日期</button>");

  document.write("<div style='position:absolute;display:none;text-align:center;width:0px;height:0px;overflow:visible' onselectstart='return false;'>");
  document.write("  <div style='position:absolute;left:-60px;top:20px;width:142px;height:165px;background-color:#F6F6F6;border:1px solid #245B7D;' class=ds_font>");
  document.write("    <table cellpadding=0 cellspacing=1 width=140 height=20 bgcolor=#CEDAE7 onmousedown='DS_x=event.x-parentNode.style.pixelLeft;DS_y=event.y-parentNode.style.pixelTop;setCapture();' onmouseup='releaseCapture();' onmousemove='dsMove(this.parentNode)' style='cursor:move;'>");
  document.write("      <tr align=center>");
  document.write("        <td width=12% onmouseover=this.className='ds_border' onmouseout=this.className='' onclick=subYear(this) title='

页: [1]

Powered by Discuz! Archiver 7.0.0  © 2001-2009 Comsenz Inc.