日期:2014-05-18  浏览次数:20396 次

Web上使用日历控件,点击后弹出类似MessageBox,选择后我想取得他的返回值,大家帮帮忙啊
我需要点击日历控件上的日期,然后弹出一个类似MessageBox的对话框,有YES和NO,选择后我想取得这个返回值,大家有什么好的方法吗??我用JS脚本写能取得他的返回值,可是总是慢一步。。刷新一次后才得到他的值。有答案了马上结帖。谢谢大家了

------解决方案--------------------
up
------解决方案--------------------
重写RENDER方法
------解决方案--------------------
----------------------------calendar.htm--------------------------------
<%@ Page %>
<HTML>
<HEAD>
<META NAME= "GENERATOR " Content= "Microsoft Visual Studio 6.0 " charset= "GB2312 ">
<STYLE TYPE= "text/css ">
table{font-size:9pt}
.today {BACKGROUND: #cccccc}
.satday{color:green}
.sunday{color:red}
.days {color:#777777}
.btn{width:15pt;height:14pt}
.sel{height:15pt;font-size:9pt}
</STYLE>
<SCRIPT LANGUAGE= "JavaScript ">

//All right reserved by Takemura
//中文月份,如果想显示英文月份,修改下面的注释
/*var months = new Array( "January?, "February?, "March ", "April ", "May ", "June ", "July ", "August ", "September ",
"October ", "November ", "December ");*/
var months = new Array( "一月 ", "二月 ", "三月 ", "四月 ", "五月 ", "六月 ", "七月 ", "八月 ", "九月 ", "十月 ", "十一月 ", "十二月 ");
var daysInMonth = new Array(31, 28, 31, 30, 31, 30, 31, 31,30, 31, 30, 31);

//中文周 如果想显示 英文的,修改下面的注释
/*var days = new Array( "Sunday ", "Monday ", "Tuesday ", "Wednesday ", "Thursday ", "Friday ", "Saturday ");*/
var days = new Array( "星期日 ", "星期一 ", "星期二 ", "星期三 ", "星期四 ", "星期五 ", "星期六 ");

function getDays(month, year) {
//判断当前是否是闰年
if (1 == month)
return ((0 == year % 4) && (0 != (year % 100))) ||(0 == year % 400) ? 29 : 28;
else
return daysInMonth[month];
}

function getToday() {
//得到今天的年,月,日
this.now = new Date();
this.year = this.now.getFullYear();
this.month = this.now.getMonth();
this.day = this.now.getDate();
}

today = new getToday();

//生成新日历
function newCalendar(vTemp) {
today = new getToday();
var objMonth = document.all.month
var objYear = document.all.year
var parseYear = parseInt(objYear[objYear.selectedIndex].text);
//滚动月份
if (vTemp == -1){ //前滚,处理1月
if (objMonth.selectedIndex == 0){
if (parseInt(objYear[objYear.selectedIndex].text) == today.year - 50){
return false;
}
objMonth.selectedIndex = 11;
objYear.selectedIndex = objYear.selectedIndex - 1
var newCal = new Date(parseInt(objYear[objYear.selectedIndex].text),11,1)
}else{
objMonth.selectedIndex = objMonth.selectedIndex - 1
var newCal = new Date(parseYear,objMonth.selectedIndex,1);
}
}else if (vTemp == 1){ //后滚,处理12月
if (objMonth.selectedIndex == 11){
if (parseInt(objYear[objYear.selectedIndex].text) == today.year + 8 - 1){
return false;
}
objMonth.selectedIndex = 0;
objYear.selectedIndex = objYear.selectedIndex + 1
var newCal = new Date(parseInt(objYear[objYear.selectedIndex].text),0,1)
}else{
objMonth.selectedIndex = objMonth.selectedIndex + 1
var newCal = new Date(parseYear,objMonth.selectedIndex ,1);
}