<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 并将其附加到输入

        时间:2023-08-01
        <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 并将其附加到输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:有时使用&lt;BR/&gt;是不是很糟糕? 下一篇:无法在 ajax 中处理 302 重定向,为什么?

                  相关文章

                    <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>
                  1. <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>