我做了个UI上面上搞一个textbox, 一点textbox就可以出现calendar,选择日期后,calendar就会消失,最后日期就会显示在textbox里,因为我做的web application所以不能用datetimepicker,我在网上查了一下,说是可以用自定义控件,可是我不知道具体怎么搞?
有没有前辈可以帮帮忙啊?
万分感谢~~~
有没有前辈可以帮帮忙啊?
万分感谢~~~
解决方案 »
- Access to the path 'temp' is denied.
- IIS Web服务,创建不了虚拟服务
- 是高手就进来
- 关于.net桌面程序打包的菜鸟问
- |zyciis| asp.net如何来正确提交POST过来的数据,谢谢 有代码
- 如何实现TextBox与DropDownList的级联
- 我是新手,想知道分页中DataGrid1.CurrentPageIndex =e.NewPageIndex中的e是什么意思?特别想知道。所以60分
- 用多选框限制按钮的状态..
- 谁能解释一下" 数据绑定"的问题?MSDN解释的太少.
- 如何在ASP.NET中接受页面传递的字符串?是要客户端FORM中的客户端控件里的字符串
- 关于.net中的transaction的问题!
- repeater中的dropdownlist
楼主多给我分哦
为了这分 我辛劳再辛劳
或者用ajaxcontroltoolkit里自带的日历控件 我现在都是用这个
自定义tetbox
我发三个完整的小例子代码给你
[email protected]
{
var e = window.event.srcElement; writeIframe();
var o = WebCalendar.calendar.style; WebCalendar.eventSrc = e;
if (arguments.length == 0) WebCalendar.objExport = e;
else WebCalendar.objExport = eval(arguments[0]); WebCalendar.iframe.tableWeek.style.cursor = WebCalendar.drag ? "move" : "default";
var t = e.offsetTop, h = e.clientHeight, l = e.offsetLeft, p = e.type;
while (e = e.offsetParent){t += e.offsetTop; l += e.offsetLeft;}
o.display = ""; WebCalendar.iframe.document.body.focus();
var cw = WebCalendar.calendar.clientWidth, ch = WebCalendar.calendar.clientHeight;
var dw = document.body.clientWidth, dl = document.body.scrollLeft, dt = document.body.scrollTop;
if (document.body.clientHeight + dt - t - h >= ch) o.top = (p=="image")? t + h : t + h + 6;
else o.top = (t - dt < ch) ? ((p=="image")? t + h : t + h + 6) : t - ch;
if (dw + dl - l >= cw) o.left = l; else o.left = (dw >= cw) ? dw - cw + dl : dl; if (!WebCalendar.timeShow) WebCalendar.dateReg = /^(\d{1,4})(-|\/|.)(\d{1,2})\2(\d{1,2})$/;
else WebCalendar.dateReg = /^(\d{1,4})(-|\/|.)(\d{1,2})\2(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})$/; try{
if (WebCalendar.objExport.value.trim() != ""){
WebCalendar.dateStyle = WebCalendar.objExport.value.trim().match(WebCalendar.dateReg);
if (WebCalendar.dateStyle == null)
{
WebCalendar.thisYear = new Date().getFullYear();
WebCalendar.thisMonth = new Date().getMonth()+ 1;
WebCalendar.thisDay = new Date().getDate();
alert("原文本框里的日期有错误!\n可能与你定义的显示时分秒有冲突!");
writeCalendar(); return false;
}
else
{
WebCalendar.thisYear = parseInt(WebCalendar.dateStyle[1], 10);
WebCalendar.thisMonth = parseInt(WebCalendar.dateStyle[3], 10);
WebCalendar.thisDay = parseInt(WebCalendar.dateStyle[4], 10);
WebCalendar.inputDate = parseInt(WebCalendar.thisDay, 10) +"/"+ parseInt(WebCalendar.thisMonth, 10) +"/"+
parseInt(WebCalendar.thisYear, 10); writeCalendar();
}
} else writeCalendar();
} catch(e){writeCalendar();}
}
...//太长 贴不出来
<script type="text/javascript" language="javascript" src="../Calendar.js"></script><asp:TextBox ID="txStartDate" runat="server" onfocus="calendar()"></asp:TextBox>