HTML5日期和时间表单

时间:2016-02-22 06:57:17

标签: html html5

我刚刚启动了HTML并创建了这个表单:

<!DOCTYPE html>
<html>
  <head>
    <title> HTML5 Testing Nitesh </title>
    <meta charset ="utf-8">
  </head>
  <body>
    <form method = "get" action="http://www.msn.com">
      <p>
        <label> Enter Colour Code </label>
        <input type ="color" autofocus /> 
      </p>
      <p>
        <label> Enter The Date </label>
        <input type = "date"/>
      </p>
      <p>
        <label> Enter date with time </label>
        <input type = "datetime" />
      </p>
      <p>
        <label> Enter local date and time </label>
        <input type = "datetime-local" />
      </p>
      <br/><br/>
      <input type = "submit"  value="Submit"/>
      <input type = "reset" value="Reset"/>
    </form>
  </body>
</html>

现在的问题是我无法正确输入日期时间和当地日期与时间(尝试谷歌浏览器,Microsoft Edge和IE)的值,虽然只是日期列打开日历框输入日期。

1 个答案:

答案 0 :(得分:-1)

尝试使用以下代码可能会对您有所帮助。

$('#datetimepicker').datetimepicker({
  format: 'dd/MM/yyyy hh:mm:ss',
  language: 'pt-BR'
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript"src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/js/bootstrap.min.js"></script>
<script type="text/javascript" src="http://tarruda.github.com/bootstrap-datetimepicker/assets/js/bootstrap-datetimepicker.min.js">
    </script>
<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/css/bootstrap-combined.min.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" media="screen" href="http://tarruda.github.com/bootstrap-datetimepicker/assets/css/bootstrap-datetimepicker.min.css">

<div id="datetimepicker" class="input-append date">
    <input type="text" placeholder="dd/MM/yyyy hh:mm:ss"/>
    <span class="add-on">
      <i data-time-icon="icon-time" data-date-icon="icon-calendar"></i>
     </span>
</div>