日期:2014-05-16  浏览次数:20453 次

js时间控件的运用
jsp 页面:
<tr>
      <td><div align="right">入库时间:</div></td>
      <td><input name="stardate" type="text" size="20" onClick="ShowDate.fPopCalendar('stardate','stardate',event);"/></td>
      <td>至</td>
      <td><input name="enddate" type="text" size="20" onClick="ShowDate.fPopCalendar('enddate','enddate',event);"/></td>
    </tr>
..............



tool.js:
<IFRAME id="ShowDate"  name="ShowDate"
style=" visibility: hidden;BORDER-RIGHT: 2px ridge; BORDER-TOP: 2px ridge; Z-INDEX: 65535; BORDER-LEFT: 2px ridge; BORDER-BOTTOM: 2px ridge; POSITION: absolute" 
src="/salary/stores/inc/calendar.html" frameBorder=no crolling=no>
</IFRAME>

calendar.html
<html>
<head>
<script language="JavaScript" type="text/javascript">
<!--
document._domino_target = "_self";
function _doClick(v, o, t, h) {
  var form = document._Calendar;
  if (form.onsubmit) {
     var retVal = form.onsubmit();
     if (typeof retVal == "boolean" && retVal == false)
       return false;
  }
  var target = document._domino_target;
  if (o.href != null) {
    if (o.target != null)
       target = o.target;
  } else {
    if (t != null)
      target = t;
  }
  form.target = target;
  form.__Click.value = v;
  if (h != null)
    form.action += h;
  form.submit();
  return false;
}
// -->
</script>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"></head>
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" onmousedown="if(event.button==2||event.button==3) alert(&quot;本窗口禁止使用鼠标右键!&quot;)">
<input type="hidden" name="__Click" value="0"><STYLE type=text/css>
.BUTTON_01{
border-left: 1px solid #FFFFFF;
border-right: 1px solid #C0C0C0;
border-top: 1px solid #FFFFFF;
border-bottom: 1px solid #C0C0C0;
background-color: #F0F0F0
}
A:link {
TEXT-DECORATION: none
}
A:visited {
TEXT-DECORATION: none
}
TD {
VERTICAL-ALIGN: middle; TEXT-ALIGN: center
}
.CalHead {
FONT:   8pt Arial; COLOR: white
}
.CalCell {
FONT: 8pt Arial; CURSOR: hand
}
.HeadBtn {
FONT: 10pt Fixedsys; VERTICAL-ALIGN: middle; WIDTH: 18px; HEIGHT: 22px

}
.HeadBox {
FONT-WEIGHT: normal; FONT-SIZE: 10pt; VERTICAL-ALIGN: middle; LINE-HEIGHT: normal; FONT-STYLE: normal; FONT-VARIANT: normal
}
.Today {
FONT:   10pt Arial; COLOR: white
}
</STYLE>
<SCRIPT>
<!-- Begin Configurable Part
var giStartYear = 1950;
var giEndYear = 2030;
var giCellWidth = 16;
var gMonths = new Array("01","02","03","04","05","06","07","08","09","10","11","12");
var gcOtherDay = "gray";
var gcToggle = "yellow";
var gcBG = "#E3F6FF";
var gcTodayBG = "white";
var gcFrame = "#1DAF48";
var gcHead = "white";
var gcWeekend = "red";
var gcWorkday = "black";
var gcCalBG = "#6699cc";
//-- End Configurable Part -->
<!-- Begin Non-editable part
var gcTemp = gcBG;
var gdCurDate = new Date();
var giYear = gdCurDate.getFullYear();
var giMonth = gdCurDate.getMonth()+1;
var giDay = gdCurDate.getDate();
var tbMonSelect, t