首页 新闻 会员 周边

如何让日历控件输入相应的日期TextBox响应事件?

0
[已关闭问题]
如何让日历控件输入相应的日期TextBox响应事件?我实验了,如果手动在textbox里面输入日期就能生成回传,但是如果靠js就生成不了事件,请求援助
田志鹏的主页 田志鹏 | 初学一级 | 园豆:185
提问于:2008-05-09 08:30
< >
分享
其他回答(2)
0
田志鹏 能不你的问题说的更详细一点吗? 要是有DEMO附上更好了。
金鱼 | 园豆:1090 (小虾三级) | 2008-05-09 09:43
0
CS页面: using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { this.Calendar1.Attributes.Add("style", "display:none;border-width:1px;border-style:solid;border-collapse:collapse;z-index: 100; left: 0px;"); TextBox1.Attributes.Add("onfocus", "javascript:document.getElementById('Calendar1').style.display=''"); } protected void Calendar1_SelectionChanged(object sender, EventArgs e) { TextBox1.Text = this.Calendar1.SelectedDate.ToShortDateString(); Calendar1.Attributes.Add("onblur", "javascript:document.getElementById('Calendar1').style.display='none'"); } } htmld页面: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Calendar1.aspx.cs" Inherits="_Default" %> <!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 id="Head1" runat="server"> <title>无标题页 </title> </head> <body> <form id="form1" runat="server"> <div> <asp:TextBox ID="TextBox1" runat="server"> </asp:TextBox> <asp:Calendar ID="Calendar1" runat="server" OnSelectionChanged="Calendar1_SelectionChanged"> </asp:Calendar> </div> </form> </body> </html>
小孤狸 | 园豆:7 (初学一级) | 2008-05-09 12:00
0
就是让Textbox失去焦点时,触发相应的事件不就成了。也就是二楼所说的办了。
伽马科技.攻城师 | 园豆:1303 (小虾三级) | 2008-05-09 17:09
如果手动在textbox里面输入日期就能生成回传,但是如果靠js就生成不了事件 onchage事件不能相应
支持(0) 反对(0) 1234353556 | 园豆:200 (初学一级) | 2009-09-13 13:11
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册