cs ①
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Acction;
using System.Data;
public partial class Query_Business : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Init_Page();
BindData();
}
}
protected void Init_Page()
{
double startdate = 0.0;
startdate = (-1) * Convert.ToDouble(System.Configuration.ConfigurationManager.AppSettings["startdate"].ToString());
this.txt_SDate.Value = DateTime.Now.AddDays(startdate).ToShortDateString();
this.txt_EDate.Value = DateTime.Now.ToShortDateString();
}
protected void btn_Query_Click(object sender, EventArgs e)
{
BindData();
}
private void BindData()
{
double startdate = 0.0;
startdate = (-1) * Convert.ToDouble(System.Configuration.ConfigurationManager.AppSettings["startdate"].ToString());
string sdate = (txt_SDate.Value == "" ? DateTime.Now.AddDays(startdate).ToShortDateString() : txt_SDate.Value);
string edate = (txt_EDate.Value == "" ? DateTime.Now.ToShortDateString() : txt_EDate.Value);
string Name = txt_Name.Value;
string type = sl_Way.Items[sl_Way.SelectedIndex].Value.ToString();
Ac_Query query = new Ac_Query ();
DataTable dt =query .Query_Business (Name,sdate ,edate ,type );
rp_list.DataSource = dt;
rp_list.DataBind();
}
}
Acction ②
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using PublicClass;
using BLL;
namespace Acction
{
public class Ac_Query
{
DataTable dt = new DataTable();
OperateBusi ob = new OperateBusi();
/// <summary>
/// 查询Business
/// </summary>
/// <param name="Name">模糊匹配</param>
/// <param name="SDate">起始时间</param>
/// <param name="EDate">结束时间</param>
/// <returns></returns>
public DataTable Query_Business(string Name, string SDate, string EDate,string type)
{
string sql = "Query_Business ";
sql += "'" + Name + "',";
sql += "'" + SDate + "',";
sql += "'" + EDate + "',";
sql += type;
dt = ob.ExecBusiOrder(sql);
return dt;
}
}
}
Proc ③
if exists (select * from sys.objects where object_id = object_id ('Query_Business') and type in ('P','FN'))
drop proc Query_Business
go
create proc Query_Business
@Name varchar(300), --模糊匹配
@StartDate datetime , --起始时间
@EndDate datetime, --结束时间
@Type int
as
set nocount on
set @EndDate =@EndDate +1
select *
from dbo.Cooperation
where (F_Name like '%'+@Name+'%' or L_Name like '%'+@Name+'%' or Co_Content like '%'+@Name+'%')
and Sub_Date >=@StartDate
and Sub_Date <@EndDate
and Type = @Type
go
设计图
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Query_Business.aspx.cs" Inherits="Query_Business" %>
<!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 runat="server">
<title></title>
<script language ="javascript" type ="text/javascript" >
/******************************** 如果您使用本日历控件 请保留该信息 谢谢! ***********************************
Author: Jack Meng
Created Date: 2009-04-28 15:26:34
MSN:xiaoqiang0036@
Email: xiaoqiang0036@
Blog: http://hi.baidu.com/sjbh
Version: 3.0
Description:
这是一个日历 Javascript 页面脚本控件,适用于微软的 IE (5.0以上)浏览器
该时间控件主要参考
******************************
* http:// *
* Creation date: 2006-11-22 *
******************************
主调用函数是 SetDateTime(this[,object[,DefaultDate]]),[object]是控件输出的控件的id或name属性值,[DefaultDate]是日期型的字符串,
SetDateTime 方法的参数个数可以有1个,2个,3个,如:
SetDateTime(this):this表示需要输出时间字符的控件
SetDateTime(this,txt):this表示激发显示时间的控件,txt表示需要输出时间字符的控件,
SetDateTime(this,txt,'2009-04-30'):this表示激发显示时间的控件,txt表示需要输出时间字符的控件,'2009-04-30'表示时间控件默认显示的时间
举几个例子:
一、<input type="text" name="a1" onclick="SetDateTime(this)" />
二、<input type="text" id="a2" /><input type="button" value="Time" onclick="SetDateTime(this,a2)" />
三、<input type="text" id="a3" /><input type="button" value="Time" onclick="SetDateTime(this,a3,'2009-04-30')" />
技巧:当使用默认时间的时候,月和日如果设置超出最大值,将计算出实际的日期。
例如:设置默认日期为'2006-14-36',将显示的实际日期是 2007-03-08,月份多两个月到下一年的二月份,而二月只有28天,36和28差8天,
所以月后推一个月,显示的是2007-03-08,以此类推。
本日历的年份限制是(1000 - 9999)
按[Esc]键可以关闭该控件
在年和月的显示地方点击时会分别出年与月的下拉框
控件外任意点击一点即可关闭该控件
History:
2009-04-29 Jack Meng
1.可以点击今天直接获取今天的日期
2.增加了你可以按[Esc]键退出时间控件
2009-04-30 Jack Meng
1.为了客户要求的日期格式,增加了时间格式化函数 Date.prototype.formatString = function(format),你可以自己定义时间的格式字符串
2009-08-07 Jack Meng
今天修改了两个问题,版本文件是:v3.0
1.修改样式:原来的2.1的版本只能在IE6下有样式效果,到IE7下就丢失样式的bug问题
2.皮肤:现在总共做了两个皮肤,skin=Default,Green; 可以根据自己需要增加皮肤;
************************************************************************************************/
//==================================================== 参数设定部分 =======================================================
var showMoreDay = true; // 是否显示上月和下月的日期 false 或 true
var Obj = null; //原来是输出HTML的
var date = null; //保存当前时间或是用户输入的时间
var dateInput = null; //输入框
var timer = null; //时间戳
var objdiv = null; //创建的DIV
var dateFormat = "yyyy-MM-dd"; //时间格式化输出样式,注意大小写, y:年;M:月;d:日;h:小时;m:分钟;s:秒S:毫秒;
var inputObj = null; //输出时间的控件
var targetObj = null; //激发显示的对象
var dragObj = null; //拖拽对象
var mouseOffset = null;
/*=============================== [ 定义皮肤包 Start ] ===============================*/
//蓝色皮肤包,此皮肤为原有皮肤数据
var Default = {
borderColor: "#909eff", //边框颜色
headerBackColor: "#909EFF", //表头背景颜色
headerFontColor: "#ffffff", //表头字体颜色
bodyBarBackColor: "#f4f4f4", //日历标题背景色
bodyBarFontColor: "#000000", //日历标题字体色
bodyBackColor: "#ffffff", //日历背景色
bodyFontColor: "#000000", //日历字体色
selectBackColor: "#B5C5EB", //鼠标滑过或选择日期的背景颜色
bodyHolidayFontColor: "#ff0000", //假日字体色
watermarkColor: "#d4d4d4", //背景水印色
moreDayColor: "#cccccc" //其他月份日期颜色
};
//淡绿色皮肤包
var Green = {
borderColor: "#74D2D9", //边框颜色
headerBackColor: "#74d2d9", //表头背景颜色
headerFontColor: "#08575B", //表头字体颜色
bodyBarBackColor: "#BDEBEE", //日历标题背景色
bodyBarFontColor: "#08575B", //日历标题字体色
bodyBackColor: "#EDFBFB", //日历背景色
bodyFontColor: "#000000", //日历字体色
selectBackColor: "#B5CAEB", //选择日期的颜色
bodyHolidayFontColor: "#ff0000", //假日字体色
watermarkColor: "#d4d4d4", //背景水印色
moreDayColor: "#cccccc" //其他月份日期颜色
};
var skin = Default; //定义所使用的皮肤包
/*=============================== [ 定义皮肤包 End ] ===============================*/
//主调函数,请参考上面的使用说明
function SetDateTime() {
if (getObjById('Calendar') == null) {
createrCalendar();
}
if (arguments.length > 3 || arguments.length == 0) {
alert("对不起!传入参数不对!");
return;
}
var _date = null;
var _evObj = null;
var _initValue = null;
for (i = 0; i < arguments.length; i++) {
if (typeof (arguments[i]) == "object") {
if (_evObj == null) {
_evObj = arguments[i];
}
else {
_date = arguments[i];
}
}
if (typeof (arguments[i]) == "string") {
_initValue = arguments[i];
}
}
_date = _date || _evObj;
if (_date.type != "text") {
_date = null;
}
inputObj = _date;
targetObj = _evObj
if (!_date) {
alert("传入参数错误!"); return;
}
this.dateInput = _date;
_date = _date.value;
if (_date == "" && _initValue) {
_date = _initValue;
}
this.bindDate(_date);
var _target = getPosition(_evObj);
var _obj = getObjById("Calendar");
_obj.style.display = "";
_obj.style.left = _target.x + 'px';
//document.body.clientHeight:客户端body的高度;
//_target.y:激发显示时间控件自身的y坐标
//_evObj.clientHeight:激发显示时间控件自身的高度
//_obj.clientHeight:时间控件DIV自身的高度
if ((document.body.clientHeight - (_target.y + _evObj.clientHeight)) >= _obj.clientHeight) {
_obj.style.top = ((_target.y + _evObj.clientHeight) + 3) + 'px';
}
else if (_target.y >= _obj.clientHeight) {
_obj.style.top = ((_target.y - _obj.clientHeight) - 5) + 'px';
}
else {
_obj.style.top = '0px';
}
}
function createrCalendar() {
objdiv = document.createElement("div");
objdiv.innerHTML = createrDIV();
document.body.appendChild(objdiv);
}
function createrDIV() {
getStyle1();
var str = '';
// str += getStyle2();
str += '<div Author="alin" class="calendar" style="display:none;" onselectstart="return false" oncontextmenu="return false" id="Calendar">\n';
str += '<div Author="alin" class="cdrWatermark" id="cdrWatermark"></div><div id="cdrBody" style="position:absolute;left:0px;top:0px;z-index:2;width:140px;">';
str += getHeader();
str += getBody();
str += '</div><div Author="alin" id="cdrMenu" style="position:absolute;left:0px;top:0px;z-index:3;display:none;" onmouseover="';
str += 'showMenu(null);" onmouseout="hideMenu();"></div></div>';
return str;
}
/*==== 样式属性 jack ====*/
function getStyle() {
var sheets = document.styleSheets;
var TimeCssCount = 0;
for (i = 0; i < sheets.length; i++) {
if (sheets[i].name == "timeCss") {
TimeCssCount++;
}
}
if (TimeCssCount == 0) {
if (document.all) {
window.style = "";
window.style += '.calendar{position:absolute;width:140px!important;width /**/:142px;height:184px!important;height /**/:174px;background-color:' +
this.styleCss.bodyBackColor + ';border:1px solid ' + this.styleCss.borderColor + ';left:0px;top:0px;z-index:9999;}\n';
window.style += '.cdrHeader{background-color:' + this.styleCss.headerBackColor + ';width:140px;height:22px;font-size:12px;color:' +
this.styleCss.headerFontColor + ';}\n';
window.style += '.cdrWatermark{position:absolute;left:0px;top:55px;width:140px;font-family: Arial Black;font-size:50px;color:';
window.style += styleCss.watermarkColor + ';z-index:1;text-align:center;}\n';
window.style += '.cdrBodyBar{background-color:' + this.styleCss.bodyBarBackColor + ';font-size:12px;color:' +
this.styleCss.bodyBarFontColor + ';width:140px;height:20px;}\n';
window.style += '.cdrBody{width:140px;height:122px!important; height:110px;font-size:12px;cursor:pointer;color:' + this.styleCss.bodyFontColor + ';}\n';
window.style += '.dayOver{height:16px;padding:0px;border:1px solid black;background-color:#f4f4f4;}\n';
window.style += '.dayOut{padding:1px;border:none;height:16px;}\n';
window.style += '.menuOver{background-color:' + this.styleCss.headerBackColor + ';color:' + this.styleCss.headerFontColor + ';font-size:12px;}\n';
window.style += '.headerOver{border:1px solid black;background-color:#f4f4f4;color:black;cursor:default;}\n';
window.style += '.cdrMenu{font-size:12px;border:1px solid #000000;background-color:#ffffff;cursor:default;width:100%}\n';
window.style += 'html>body #Calendar{width:142px;174px;}';
var calendarCss = document.createStyleSheet("javascript:style");
calendarCss.name = "timeCss";
}
}
}
function getStyle1() {
var sheets = document.styleSheets;
var TimeCssCount = 0;
for (i = 0; i < sheets.length; i++) {
if (sheets[i].name == "timeCss") {
TimeCssCount++;
}
}
if (TimeCssCount == 0) {
if (document.all) {
var str = "";
str += '.calendar{position:absolute;width:140px!important;width /**/:142px;height:184px!important;height /**/:174px;background-color:' +
this.skin.bodyBackColor + ';border:1px solid ' + this.skin.borderColor + ';left:0px;top:0px;z-index:9999;}\n';
str += '.cdrHeader{background-color:' + this.skin.headerBackColor + ';width:140px;height:22px;font-size:12px;color:' +
this.skin.headerFontColor + ';}\n';
str += '.cdrWatermark{position:absolute;left:0px;top:55px;width:140px;font-family: Arial Black;font-size:50px;color:';
str += skin.watermarkColor + ';z-index:1;text-align:center;}\n';
str += '.cdrBodyBar{background-color:' + this.skin.bodyBarBackColor + ';font-size:12px;color:' +
this.skin.bodyBarFontColor + ';width:140px;height:20px;}\n';
str += '.cdrBody{width:140px;height:122px!important; height:110px;font-size:12px;cursor:pointer;color:' + this.skin.bodyFontColor + ';}\n';
str += '.dayOver{height:16px;padding:0px;border:1px solid black;background-color: ' + this.skin.selectBackColor + ';}\n';
str += '.dayOut{padding:1px;border:none;height:16px;}\n';
str += '.menuOver{background-color:' + this.skin.headerBackColor + ';color:' + this.skin.headerFontColor + ';font-size:12px;}\n';
str += '.headerOver{border:1px solid black;background-color: ' + this.skin.selectBackColor + ';color:black;cursor:default;}\n';
str += '.cdrMenu{font-size:12px;border:1px solid #000000;background-color:#ffffff;cursor:default;width:100%}\n';
str += 'html>body #Calendar{width:142px;174px;}';
var calendarCss = document.createStyleSheet("javascript:style");
calendarCss.name = "timeCss";
calendarCss.cssText = str;
}
}
}
function getStyle2() {
var str = '<style>';
str += '.calendar{position:absolute;width:140px!important;width /**/:142px;height:184px!important;height /**/:174px;background-color:' +
this.styleCss.bodyBackColor + ';border:1px solid ' + this.styleCss.borderColor + ';left:0px;top:0px;z-index:9999;}\n';
str += '.cdrHeader{background-color:' + this.styleCss.headerBackColor + ';width:140px;height:22px;font-size:12px;color:' +
this.styleCss.headerFontColor + ';}\n';
str += '.cdrWatermark{position:absolute;left:0px;top:55px;width:140px;font-family: Arial Black;font-size:50px;color:';
str += styleCss.watermarkColor + ';z-index:1;text-align:center;}\n';
str += '.cdrBodyBar{background-color:' + this.styleCss.bodyBarBackColor + ';font-size:12px;color:' +
this.styleCss.bodyBarFontColor + ';width:140px;height:20px;}\n';
str += '.cdrBody{width:140px;height:122px!important; height:110px;font-size:12px;cursor:pointer;color:' + this.styleCss.bodyFontColor + ';}\n';
str += '.dayOver{height:16px;padding:0px;border:1px solid black;background-color:#f4f4f4;}\n';
str += '.dayOut{padding:1px;border:none;height:16px;}\n';
str += '.menuOver{background-color:' + this.styleCss.headerBackColor + ';color:' + this.styleCss.headerFontColor + ';font-size:12px;}\n';
str += '.headerOver{border:1px solid black;background-color:#f4f4f4;color:black;cursor:default;}\n';
str += '.cdrMenu{font-size:12px;border:1px solid #000000;background-color:#ffffff;cursor:default;width:100%}\n';
str += 'html>body #Calendar{width:142px;174px;}';
str += '</style>';
return str;
}
function getHeader() {
var str = '<table Author="alin" class="cdrHeader" cellSpacing="2" cellPadding="0"><tr Author="alin" align="center">\n';
str += '<td Author="alin" onmouseover="this.className=\'headerOver\'" onmouseout="this.className=\'\'" id="previousYear"';
str += 'title="上一年份" style="cursor:pointer;width:10px;" onclick="onChangeYear(false);"><<</td>\n';
str += '<td Author="alin" onmouseover="this.className=\'headerOver\'" onmouseout="this.className=\'\'" id="previousMonth"';
str += 'title="上一月份" style="cursor:pointer;width:10px;" onclick="onChangeMonth(false);"><</td>\n';
str += '<td Author="alin" onmouseover="this.className=\'headerOver\'" id="currentYear" style="width:50px;"';
str += ' onclick="showMenu(true);" onmouseout="this.className=\'\';hideMenu();">0</td>\n';
str += '<td Author="alin" onmouseover="this.className=\'headerOver\'" id="currentMonth" onclick="';
str += 'showMenu(false);" onmouseout="this.className=\'\';hideMenu();">0</td>\n';
str += '<td Author="alin" onmouseover="this.className=\'headerOver\'" onmouseout="this.className=\'\'" id="nextMonth" ';
str += 'title="下一月份" style="cursor:pointer;width:10px;" onclick="onChangeMonth(true);">></td>\n';
str += '<td Author="alin" onmouseover="this.className=\'headerOver\'" onmouseout="this.className=\'\'" id="nextYear" ';
str += 'title="下一年份" style="cursor:pointer;width:10px;" onclick="onChangeYear(true);">>></td></tr>\n';
str += '</table>\n';
return str;
}
function getBody() {
var n = 0;
var str = this.getBodyBar();
str += '<table Author="alin" class="cdrBody" cellSpacing="2" cellPadding="0">\n';
for (i = 0; i < 6; i++) {
str += '<tr Author="alin" align="center">';
for (j = 0; j < 7; j++) {
str += '<td Author="alin" class="dayOut" id="cdrDay' + (n++) + '" width="13%"></td>\n';
}
str += '</tr>';
}
str += '</table>\n';
str += '<table Author="alin" class="cdrBodyBar" cellSpacing="2" cellPadding="0"><tr align="center" Author="alin"><td Author="alin"';
str += 'style="cursor:pointer;" title="转到今天" value="' + new Date().toFormatString("yyyy-mm-dd") + '" onclick="onClick(this)">';
str += '今天:' + new Date().toFormatString("yyyy年mm月dd日") + '</td></tr></table>\n';
return str;
}
function getBodyBar() {
var str = '<table Author="alin_bar" id="cdrBodyBar" class="cdrBodyBar" style="cursor:move;" cellSpacing="2" cellPadding="0">';
str += '<tr Author="alin_bar" align="center">\n';
var day = new Array('日', '一', '二', '三', '四', '五', '六');
for (i = 0; i < 7; i++) {
str += '<td Author="alin_bar">' + day[i] + '</td>\n';
}
str += '</tr></table>';
return str;
}
function getYearMenu(year) {
var str = '<table Author="alin" cellSpacing="0" class="cdrMenu" cellPadding="0">\n';
for (i = 0; i < 10; i++) {
var _year = year + i;
var _date = new Date(_year, this.date.getMonth(), this.date.getDate());
str += '<tr Author="alin" align="center"><td Author="alin" width="13%" height="16" ';
if (this.date.getFullYear() != _year) {
str += 'onmouseover="this.className=\'menuOver\'" onmouseout="this.className=\'\'" ';
}
else {
str += 'class="menuOver"';
}
str += 'onclick="bindDate(\'' + _date.toFormatString("-") + '\')">' + _year + '年</td>\n';
str += '</tr>';
}
str += '<tr Author="alin" align="center"><td Author="alin"><table Author="alin" style="font-size:12px;width:100%;" cellSpacing="0" cellPadding="0">\n';
str += '<tr Author="alin" align="center"><td Author="alin" onmouseover="this.className=\'menuOver\'" onmouseout="this.className=\'\'" onclick="';
str += 'getYearMenu(' + (year - 10) + ')"><<</td>\n';
str += '<td Author="alin" onmouseover="this.className=\'menuOver\'" onmouseout="this.className=\'\'" onclick="';
str += 'getYearMenu(' + (year + 10) + ')">>></td><tr>\n';
str += '</table></td></tr>\n';
str += '</table>';
var _menu = getObjById("cdrMenu");
_menu.innerHTML = str;
}
function getMonthMenu() {
var str = '<table Author="alin" cellSpacing="0" class="cdrMenu" cellPadding="0">\n';
for (i = 1; i <= 12; i++) {
var _date = new Date(this.date.getFullYear(), i - 1, this.date.getDate());
str += '</tr><tr Author="alin" align="center"><td Author="alin" height="16" ';
if (this.date.getMonth() + 1 != i) {
str += 'onmouseover="this.className=\'menuOver\'" onmouseout="this.className=\'\'" ';
}
else {
str += 'class="menuOver"';
}
str += 'onclick="bindDate(\'' + _date.toFormatString("-") + '\')">' + i + '月</td></tr>\n';
}
str += '</table>';
var _menu = getObjById("cdrMenu");
_menu.innerHTML = str;
}
/************** 为对象增加属性 **************/
//给日期Date对象增加格式化
Date.prototype.toFormatString = function(fs) {
if (fs.length == 1) {
return this.getFullYear() + fs + (this.getMonth() + 1) + fs + this.getDate();
}
fs = fs.replace("yyyy", this.getFullYear());
fs = fs.replace("mm", (this.getMonth() + 1));
fs = fs.replace("dd", this.getDate());
return fs;
}
//给日期Date对象增加格式化,注意大小写
/*
y:表示年
M:表示月
d:表示日
h:表示小时
m:表示分钟
s:表示秒钟
S:表示毫秒
*/
Date.prototype.formatString = function(format) {
var o =
{
"M+": this.getMonth() + 1, //month
"d+": this.getDate(), //day
"h+": this.getHours(), //hour
"m+": this.getMinutes(), //minute
"s+": this.getSeconds(), //second
"q+": Math.floor((this.getMonth() + 3) / 3), //quarter季度
"S": this.getMilliseconds() //millisecond
}
if (/(y+)/.test(format)) {
format = format.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
}
for (var k in o) {
if (new RegExp("(" + k + ")").test(format)) {
format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));
}
}
return format;
}
//给Number对象增加属性,判断对象为空则返回0,否则自己
Number.prototype.NaN0 = function() {
return isNaN(this) ? 0 : this;
}
function hide() {
var obj = getObjById("Calendar");
obj.style.display = "none";
}
function bindDate(date) {
var _monthDays = new Array(31, 30, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
var _arr = date.split('-');
var _date = new Date(_arr[0], _arr[1] - 1, _arr[2]);
if (isNaN(_date)) {
_date = new Date();
}
this.date = _date;
this.bindHeader();
var _year = _date.getFullYear();
var _month = _date.getMonth();
var _day = 1;
var _startDay = new Date(_year, _month, 1).getDay();
var _previYear = _month == 0 ? _year - 1 : _year;
var _previMonth = _month == 0 ? 11 : _month - 1;
var _previDay = _monthDays[_previMonth];
if (_previMonth == 1) {
_previDay = ((_previYear % 4 == 0) && (_previYear % 100 != 0) || (_previYear % 400 == 0)) ? 29 : 28;
}
_previDay -= _startDay - 1;
var _nextDay = 1;
_monthDays[1] = ((_year % 4 == 0) && (_year % 100 != 0) || (_year % 400 == 0)) ? 29 : 28;
for (i = 0; i < 40; i++) {
var _dayElement = getObjById("cdrDay" + i);
_dayElement.onmouseover = Function("onMouseOver(this)");
_dayElement.onmouseout = Function("onMouseOut(this)");
_dayElement.onclick = Function("onClick(this)");
this.onMouseOut(_dayElement);
_dayElement.style.color = "";
if (i < _startDay) {
//获取上一个月的日期
if (this.showMoreDay) {
var _previDate = new Date(_year, _month - 1, _previDay);
_dayElement.innerHTML = _previDay;
_dayElement.title = _previDate.toFormatString("yyyy年mm月dd日");
_dayElement.value = _previDate.toFormatString("-");
_dayElement.style.color = this.skin.moreDayColor;
_previDay++;
}
else {
_dayElement.innerHTML = "";
_dayElement.title = "";
}
}
else if (_day > _monthDays[_month]) {
//获取下个月的日期
if (this.showMoreDay) {
var _nextDate = new Date(_year, _month + 1, _nextDay);
_dayElement.innerHTML = _nextDay;
_dayElement.title = _nextDate.toFormatString("yyyy年mm月dd日");
_dayElement.value = _nextDate.toFormatString("-");
_dayElement.style.color = this.skin.moreDayColor;
_nextDay++;
}
else {
_dayElement.innerHTML = "";
_dayElement.title = "";
}
}
else if (i >= new Date(_year, _month, 1).getDay() && _day <= _monthDays[_month]) {
//获取本月日期
_dayElement.innerHTML = _day;
if (_day == _date.getDate()) {
this.onMouseOver(_dayElement);
_dayElement.onmouseover = Function("");
_dayElement.onmouseout = Function("");
}
if (this.isHoliday(_year, _month, _day)) {
_dayElement.style.color = this.skin.bodyHolidayFontColor;
}
var _curDate = new Date(_year, _month, _day);
_dayElement.title = _curDate.toFormatString("yyyy年mm月dd日");
_dayElement.value = _curDate.toFormatString("-");
_day++;
}
else {
_dayElement.innerHTML = "";
_dayElement.title = "";
}
}
var _menu = getObjById("cdrMenu");
_menu.style.display = "none";
}
function bindHeader() {
var _curYear = getObjById("currentYear");
var _curMonth = getObjById("currentMonth");
var _watermark = getObjById("cdrWatermark");
_curYear.innerHTML = this.date.toFormatString("yyyy年");
_curMonth.innerHTML = this.date.toFormatString("mm月");
_watermark.innerHTML = this.date.getFullYear();
}
function getToday() {
var _date = new Date();
this.bindDate(_date.toFormatString("-"));
}
function isHoliday(year, month, date) {
var _date = new Date(year, month, date);
return (_date.getDay() == 6 || _date.getDay() == 0);
}
function onMouseOver(obj) {
obj.className = "dayOver";
}
function onMouseOut(obj) {
obj.className = "dayOut";
}
function onClick(obj) {
if (obj.innerHTML != "") {
var _nowDateTime = new Date();
obj = obj.value.split('-');
obj[3] = _nowDateTime.getHours();
obj[4] = _nowDateTime.getMinutes();
obj[5] = _nowDateTime.getSeconds();
obj[6] = _nowDateTime.getMilliseconds();
var _date = new Date(obj[0], obj[1] - 1, obj[2], obj[3], obj[4], obj[5], obj[6]);
this.dateInput.value = _date.formatString(dateFormat);
}
this.hide();
}
function onChangeYear(isnext) {
var _year = this.date.getFullYear();
var _month = this.date.getMonth() + 1;
var _date = this.date.getDate();
if (_year > 999 && _year < 10000) {
if (isnext) { _year++; } else { _year--; }
}
else {
alert("年份超出范围(1000-9999)!");
}
this.bindDate(_year + '-' + _month + '-' + _date);
}
function onChangeMonth(isnext) {
var _year = this.date.getFullYear();
var _month = this.date.getMonth() + 1;
var _date = this.date.getDate();
if (isnext) { _month++; } else { _month--; }
if (_year > 999 && _year < 10000) {
if (_month < 1) { _month = 12; _year--; }
if (_month > 12) { _month = 1; _year++; }
}
else {
alert("年份超出范围(1000-9999)!");
}
this.bindDate(_year + '-' + _month + '-' + _date);
}
function showMenu(isyear) {
var _menu = getObjById("cdrMenu");
if (isyear != null) {
var _obj = (isyear) ? getObjById("currentYear") : getObjById("currentMonth");
if (isyear) {
this.getYearMenu(date.getFullYear() - 5);
}
else {
this.getMonthMenu();
}
_menu.style.top = (_obj.offsetTop + _obj.offsetHeight) + 'px';
_menu.style.left = _obj.offsetLeft + 'px';
_menu.style.width = _obj.offsetWidth + 'px';
}
if (this.timer != null) clearTimeout(this.timer);
_menu.style.display = "";
}
function hideMenu() {
var _obj = getObjById("cdrMenu");
this.timer = window.setTimeout(function() { _obj.style.display = 'none'; }, 300);
}
/*========== 公用方法开始 ==========*/
//获取DIV显示的x和y坐标
function getPosition(e) {
var left = 0;
var top = 0;
while (e.offsetParent) {
left += e.offsetLeft + (e.currentStyle ? (parseInt(e.currentStyle.borderLeftWidth)).NaN0() : 0);
top += e.offsetTop + (e.currentStyle ? (parseInt(e.currentStyle.borderTopWidth)).NaN0() : 0);
e = e.offsetParent;
}
left += e.offsetLeft + (e.currentStyle ? (parseInt(e.currentStyle.borderLeftWidth)).NaN0() : 0);
top += e.offsetTop + (e.currentStyle ? (parseInt(e.currentStyle.borderTopWidth)).NaN0() : 0);
return { x: left, y: top };
}
function getObjById(obj) {
if (document.getElementById) {
return document.getElementById(obj);
}
else {
alert("浏览器不支持!或未找到该对象!");
}
}
function mouseCoords(ev) {
if (ev.pageX || ev.pageY) {
return { x: ev.pageX, y: ev.pageY };
}
return { x: ev.clientX + document.body.scrollLeft - document.body.clientLeft, y: ev.clientY + document.body.scrollTop - document.body.clientTop };
}
function getMouseOffset(target, ev) {
ev = ev || window.event;
var docPos = getPosition(target);
var mousePos = mouseCoords(ev);
return { x: mousePos.x - docPos.x, y: mousePos.y - docPos.y };
}
function closeCalendar(evt) {
evt = evt || window.event;
var _target = evt.target || evt.srcElement;
if ((!_target.getAttribute("Author") && _target != inputObj && _target != targetObj) || evt.keyCode == 27) {
if (getObjById("Calendar")) {
getObjById("Calendar").style.display = "none";
}
}
}
//鼠标按下动作
function dragStart(evt) {
evt = evt || window.event;
var _target = evt.target || evt.srcElement;
if (_target.getAttribute("Author") == "alin_bar") {
dragObj = getObjById("Calendar");
mouseOffset = getMouseOffset(dragObj, evt);
}
}
//鼠标移动
function drag(evt) {
evt = evt || window.event;
if (dragObj) {
var mousePos = mouseCoords(evt);
dragObj.style.left = (mousePos.x - mouseOffset.x) + 'px';
dragObj.style.top = (mousePos.y - mouseOffset.y) + 'px';
}
}
//拖动结束
function dragEnd(evt) {
dragObj = null;
}
/***********End 公用方法*********/
document.onclick = closeCalendar;
document.onkeyup = closeCalendar;
document.onmousedown = dragStart;
document.onmousemove = drag;
document.onmouseup = dragEnd;
/*********结束**********/
/*========== 公用方法结束 ==========*/
</script>
</head>
<body>
<form id="form1" runat="server">
<table >
<tr ><td>名称查询</td>
<td>
<input type="text" id="txt_Name" runat="server" />
</td>
<td>
从
</td>
<td>
<input type ="text" id="txt_SDate" runat ="server" onfocus="SetDateTime(this);"/>
</td>
<td>
到
</td>
<td>
<input type ="text" id ="txt_EDate" runat ="server" onfocus="SetDateTime(this);"/>
</td>
<td>
合作方式
</td>
<td>
<select id ="sl_Way" runat ="server">
<option selected ="selected" value ="1">Agent</option>
<option value ="0">Distributor</option>
<option value ="2">OEM service</option>
</select>
</td>
<td>
<input type="button" id="btn_Query" value="查询" onserverclick="btn_Query_Click" runat ="server" />
</td>
</tr>
</table>
<div>
<br />
<asp:Repeater ID="rp_list" runat ="server" >
<HeaderTemplate >
<table width ="100%" cellspacing="1" cellpadding="1" >
<tr class="list-1" height="24px">
<td width="100px">First Name</td>
<td width="100px">Last Name</td>
<td width="100px">Email</td>
<td width="200px">Cooperation Content</td>
</tr>
</HeaderTemplate>
<ItemTemplate >
<tr>
<td class="list-2"><%# Eval("F_Name").ToString() %></td>
<td class="list-2"><%# Eval("L_Name").ToString() %></td>
<td class="list-2"><%# Eval("Email").ToString() %></td>
<td class="list-2"><%# Eval("Co_Content").ToString() %></td>
</tr>
</ItemTemplate>
<FooterTemplate >
</table>
</FooterTemplate>
</asp:Repeater>
</div>
</form>
</body>
</html>