<tfoot id='FNaip'></tfoot>

        <bdo id='FNaip'></bdo><ul id='FNaip'></ul>

    1. <legend id='FNaip'><style id='FNaip'><dir id='FNaip'><q id='FNaip'></q></dir></style></legend>
      <i id='FNaip'><tr id='FNaip'><dt id='FNaip'><q id='FNaip'><span id='FNaip'><b id='FNaip'><form id='FNaip'><ins id='FNaip'></ins><ul id='FNaip'></ul><sub id='FNaip'></sub></form><legend id='FNaip'></legend><bdo id='FNaip'><pre id='FNaip'><center id='FNaip'></center></pre></bdo></b><th id='FNaip'></th></span></q></dt></tr></i><div id='FNaip'><tfoot id='FNaip'></tfoot><dl id='FNaip'><fieldset id='FNaip'></fieldset></dl></div>

    2. <small id='FNaip'></small><noframes id='FNaip'>

      1. 如何在 Javascript 中获取当前格式化日期 dd/mm/yyyy 并将其附加到输入

        How to get current formatted date dd/mm/yyyy in Javascript and append it to an input(如何在 Javascript 中获取当前格式化日期 dd/mm/yyyy 并将其附加到输入)
        <tfoot id='O6VtC'></tfoot>

      2. <i id='O6VtC'><tr id='O6VtC'><dt id='O6VtC'><q id='O6VtC'><span id='O6VtC'><b id='O6VtC'><form id='O6VtC'><ins id='O6VtC'></ins><ul id='O6VtC'></ul><sub id='O6VtC'></sub></form><legend id='O6VtC'></legend><bdo id='O6VtC'><pre id='O6VtC'><center id='O6VtC'></center></pre></bdo></b><th id='O6VtC'></th></span></q></dt></tr></i><div id='O6VtC'><tfoot id='O6VtC'></tfoot><dl id='O6VtC'><fieldset id='O6VtC'></fieldset></dl></div>

              <tbody id='O6VtC'></tbody>
            <legend id='O6VtC'><style id='O6VtC'><dir id='O6VtC'><q id='O6VtC'></q></dir></style></legend>
            • <small id='O6VtC'></small><noframes id='O6VtC'>

                • <bdo id='O6VtC'></bdo><ul id='O6VtC'></ul>
                  本文介绍了如何在 Javascript 中获取当前格式化日期 dd/mm/yyyy 并将其附加到输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我想将当前日期添加到隐藏的 HTML 标记中,以便可以将其发送到服务器:

                  I would like to add a current date to a hidden HTML tag so that it can be sent to the server:

                  <input type="hidden" id="DATE" name="DATE" value="WOULD_LIKE_TO_ADD_DATE_HERE">
                  

                  如何将格式化的日期添加到 VALUE 属性?

                  How can I add a formatted date to the VALUE attribute?

                  推荐答案

                     const monthNames = ["January", "February", "March", "April", "May", "June",
                          "July", "August", "September", "October", "November", "December"];
                      const dateObj = new Date();
                      const month = monthNames[dateObj.getMonth()];
                      const day = String(dateObj.getDate()).padStart(2, '0');
                      const year = dateObj.getFullYear();
                      const output = month  + '
                  '+ day  + ',' + year;
                  
                      document.querySelector('.date').textContent = output; 
                  

                  这篇关于如何在 Javascript 中获取当前格式化日期 dd/mm/yyyy 并将其附加到输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  quot;Status Code:200 OK (from ServiceWorker)quot; in Chrome Network DevTools?(“状态码:200 OK(来自 ServiceWorker)在 Chrome 网络开发工具中?)
                  How to set a header for a HTTP GET request, and trigger file download?(如何为 HTTP GET 请求设置标头并触发文件下载?)
                  Adding custom HTTP headers using JavaScript(使用 JavaScript 添加自定义 HTTP 标头)
                  What is quot;X-Content-Type-Options=nosniffquot;?(什么是“X-Content-Type-Options=nosniff?)
                  SQL Query DocumentDB in Azure Functions by an integer not working(通过整数在 Azure Functions 中 SQL 查询 DocumentDB 不起作用)
                  Azure Functions [JavaScript / Node.js] - HTTP call, good practices(Azure Functions [JavaScript/Node.js] - HTTP 调用,良好实践)
                      <tbody id='nRjC8'></tbody>
                    <tfoot id='nRjC8'></tfoot>
                      <bdo id='nRjC8'></bdo><ul id='nRjC8'></ul>

                      <legend id='nRjC8'><style id='nRjC8'><dir id='nRjC8'><q id='nRjC8'></q></dir></style></legend>
                    • <small id='nRjC8'></small><noframes id='nRjC8'>

                            <i id='nRjC8'><tr id='nRjC8'><dt id='nRjC8'><q id='nRjC8'><span id='nRjC8'><b id='nRjC8'><form id='nRjC8'><ins id='nRjC8'></ins><ul id='nRjC8'></ul><sub id='nRjC8'></sub></form><legend id='nRjC8'></legend><bdo id='nRjC8'><pre id='nRjC8'><center id='nRjC8'></center></pre></bdo></b><th id='nRjC8'></th></span></q></dt></tr></i><div id='nRjC8'><tfoot id='nRjC8'></tfoot><dl id='nRjC8'><fieldset id='nRjC8'></fieldset></dl></div>