如何实现的PhoneGap / Android的日期选择器? [英] How to implement the DATE PICKER in PhoneGap/Android?

查看:108
本文介绍了如何实现的PhoneGap / Android的日期选择器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图实施日期选择器的机器人。我希望它来获取数据并显示在文本格式

I have tried to implement the date picker in android. I want it to get the data and show it in the text format

  <html>
  <head>
    <script type="text/javascript" charset="utf-8" src="cordova-2.5.0.js"></script>
    <script type="text/javascript" charset="utf-8" src="datePickerPlugin.js"></script>
  <script type="text/javascript" charset="utf-8">

  function dateTest() {
      var myNewDate = new Date();

      window.plugins.datePicker.show({
          date : myNewDate,
          mode : 'date', // date or time or blank for both
          allowOldDates : true
      }, function(returnDate) {
        var newDate = new Date(returnDate);
            currentField.val(newDate.toString("dd/MMM/yyyy"));

            // This fixes the problem you mention at the bottom of this script with it not working a second/third time around, because it is in focus.
            currentField.blur();
      });
  }
</script>
</head>
<body bgcolor="#ffffff">
<hr>DatePicker Test<hr><br>
     <input type="button" onClick ="dateTest()" value ="Today's Date!!" />
     <div id="view"></div>
</body>
</html>

我得到它作为一个警告......但无法将其保存为在同一页上的字符串

I am getting it as an alert...but unable to store it as a string on the same page

推荐答案

为什么松动乌尔头?

A &LT;输入类型=日期&GT; 将传真deppend在它的设备间pretation,在一些Android设备,它甚至不工作

A <input type="date"> will allways deppend on device's interpretation of it, in some android devices it doesn't even work,

有大量的插件,插件时,不论何种,因为它,

There is plenty of plugins, addons, whatever, for it,

我个人很喜欢,并使用mobiscroll:链接

I personally like, and use mobiscroll: Link

这篇关于如何实现的PhoneGap / Android的日期选择器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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