• 设置日期格式(input新属性)适用于chrome 360 qq浏览器,但是对于firefox和ie却不适用


    <!DOCTYPE HTML>
    <html>
    <body>
    <form action="/example/html5/demo_form.asp" method="get">
    日期和时间:<input type="datetime-local" name="user_date" value="2015/03/27 10:41" id="user_date"/>
    <input type="submit" />
    </form>
    </body>
    </html>


    或者以下这么写代码:

    <html>

    <title>Test_datetime_local</title>

    <body>

     datatime-local:<input type="datetime-local" id="mydatetime-local"/>

    <br>date:<input type="date" id="mydate"/>

    <br>week:<input type="week" id="myweek"/>

    <br>month:<input type="month" id="mymonth"/>

    <br>time:<input type="time" id="mytime"/>

    <br>datetime:<input type="datetime" id="mydatetime"/>

    <p>Click the button and set the local datetime</p>

    <button onclick="myFunction()">Click here</button>

    <p id="demo"></p>

    <script>

    function myFunction(){

        var x=document.getElementById("mydatetime-local").value;

        year=x.substring(0,4);

        month=x.substring(5,7);

        day=x.substring(8,10);

        hour=x.substring(11,13);

        minute=x.substring(14)

        format=year+"-"+day+"-"+month;

        document.getElementById("demo").innerHTML = format;

    }

    </script>

    </body>

    </html>

    打开后结果如下:一般不要使用firefox或者IE,使用其他浏览器,如百度浏览器。因为其他浏览器可能存在问题,显示效果比较差。

    接下来设置日期,

    datetime-local 设置日期格式

     这个格式适用于chrome 360 qq浏览器,但是对于firefox和ie却不适用,为此我目前还没有找到合适的办法,求指教

  • 相关阅读:
    Qt 解析EXcel文件
    Qt PC 安卓 tcp传输文件
    Qt listwigwt item 加入自定义元素
    Qt 独立运行时伴随CMD命令窗口
    xml模块
    shelve模块
    json模块 pickle模块
    sys 模块
    os模块
    添加变量
  • 原文地址:https://www.cnblogs.com/fgtt/p/6606043.html
Copyright © 2020-2023  润新知