JQuery Datepicker的问题 [英] problem with JQuery Datepicker

查看:72
本文介绍了JQuery Datepicker的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我的应用程序使用了JQuery Datepicker。

这是我的代码



 <   link     rel   = 样式表    http://ajax.googleapis.com/ajax/libs/jqueryui/1.8 .5 / themes / base / jquery-ui.css    type   =  text / css    media   =  all    /  >  
< link rel = 样式表 href = http://static.jquery.com/ui/css/demo-docs -theme / ui.theme.css type = text / css 媒体 = all / >
< script src = http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js type = < span class =code-keyword> text / javascript
> < < span class =code-leadattribute> / script >
< script src = http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/jquery-ui.min.js type = text / javascript > < / script >





这是我的剧本



< script type =   text / javascript style.ui-widget {font-size: 62  .5%}> ; 
$( document )。ready( function (){
$(< span class =code-string> #ctl00_ContentPlaceHolder1_txtPDOB)。datepicker({
changeYear: true
changeMonth: true
dateFormat:' dd / mm / yy'
minDate: new 日期' 01/01/1900'),
maxDate:' + 1Y'
yearRange:' 1900:' + 日期()。getFullYear
});
});
< / script>





这里,

当我说提交按钮txtPDOB.text显示为空&我试图将txtPDOB.text中的文本转换为Datetime。在文本框中显示空&我在那里得到错误。



任何人都可以告诉我,在从JQuery datepicker选择Date后,它没有从文本框中取出文本。

解决方案

document )。ready( function (){

#ctl00_ContentPlaceHolder1_txtPDOB)。datepicker({
changeYear: true
changeMonth: true
dateFormat:' dd / mm / yy'
minDate: new 日期' 01/01/1900' ),
maxDate:' + 1Y'
yearRange:' 1900:' + 日期 ()。getFullYear
});
});
< / script>





这里,

当我说提交按钮txtPDOB.text显示为空&我试图将txtPDOB.text中的文本转换为Datetime。在文本框中显示空&我在那里得到错误。



任何人都可以告诉我,在从JQuery datepicker选择Date后,它没有从文本框中取出文本的原因。


一旦有用的技巧是给你的文本框一个'date-picker'的CssClass属性,那么你就可以轻松地应用jQuery Datepicker ......



< asp:textbox id =fromDateSelectioncssclass =date-pickerrunat =server>< / asp:textbox> 





< script type =   text / javascript> 


Hi All,

I have used JQuery Datepicker for my application.
Here is my code

<link rel="stylesheet" http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/themes/base/jquery-ui.css" type="text/css" media="all" />
<link rel="stylesheet" href="http://static.jquery.com/ui/css/demo-docs-theme/ui.theme.css" type="text/css" media="all" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/jquery-ui.min.js" type="text/javascript"></script>



Here is my script

<script type="text/javascript" style.ui-widget { font-size: 62.5% }>
        $(document).ready(function() {
        $("#ctl00_ContentPlaceHolder1_txtPDOB").datepicker({
            changeYear: true,
            changeMonth:true,
            dateFormat: 'dd/mm/yy',
            minDate: new Date('01/01/1900'),
            maxDate: '+1Y',
            yearRange: '1900:' + Date().getFullYear
        });
        });
</script>



Here,
When i say submit button txtPDOB.text is showing empty & I am trying to convert the text which is in txtPDOB.text into Datetime. Bt the textbox showing empty & iam getting error there.

Can anybody tell me for what reason its not taking the text from textbox after selecting Date from JQuery datepicker.

解决方案

(document).ready(function() {


("#ctl00_ContentPlaceHolder1_txtPDOB").datepicker({ changeYear: true, changeMonth:true, dateFormat: 'dd/mm/yy', minDate: new Date('01/01/1900'), maxDate: '+1Y', yearRange: '1900:' + Date().getFullYear }); }); </script>



Here,
When i say submit button txtPDOB.text is showing empty & I am trying to convert the text which is in txtPDOB.text into Datetime. Bt the textbox showing empty & iam getting error there.

Can anybody tell me for what reason its not taking the text from textbox after selecting Date from JQuery datepicker.


Once useful trick for this is to give your textboxes a CssClass property of 'date-picker', then you can easily apply jQuery Datepicker like so...

<asp:textbox id="fromDateSelection" cssclass="date-picker" runat="server"></asp:textbox>



<script type="text/javascript" >


这篇关于JQuery Datepicker的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆