• <small id='FRyY5'></small><noframes id='FRyY5'>

        <bdo id='FRyY5'></bdo><ul id='FRyY5'></ul>
      <legend id='FRyY5'><style id='FRyY5'><dir id='FRyY5'><q id='FRyY5'></q></dir></style></legend>

      <tfoot id='FRyY5'></tfoot>

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

        自动提交单选按钮,但保持选中状态

        时间:2023-10-20
      1. <tfoot id='CG0s4'></tfoot>
      2. <legend id='CG0s4'><style id='CG0s4'><dir id='CG0s4'><q id='CG0s4'></q></dir></style></legend>

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

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

                    <tbody id='CG0s4'></tbody>
                  本文介绍了自动提交单选按钮,但保持选中状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在使用单选按钮对分页结果进行排序.但是,只要单击并自动提交该按钮,它就会变为未选中状态.我想保持按钮被选中,以便用户知道他们选择了哪个按钮.我该怎么做?

                  I am using radio buttons to sort through paginated results. However, whenever the button is clicked and auto-submitted, it becomes unselected. I want to keep the button selected so that the user knows which one they selected. How can I do that?

                  这是我所拥有的:

                  function autoSubmit() {
                      var formObject = document.forms['theForm'];
                      formObject.submit();
                  }
                  
                  <input type="radio" name="sort" value="time" onChange="autoSubmit();" />
                  <input type="radio" name="sort" value="year" onChange="autoSubmit();" />
                  <input type="radio" name="sort" value="name" onChange="autoSubmit();" />
                  
                  if(isset($_GET["sort"])) { 
                      $sort = $_GET["sort"];
                  }
                  

                  推荐答案

                  我猜你的代码是这样的:

                  I presume that your code is something like this:

                  <?php
                  $sort = "";
                  if(isset($_GET["sort"]))
                  { $sort = $_GET["sort"]; }
                  ?>
                  <html>
                  <head>
                  <script>
                  function autoSubmit()
                  {
                      var formObject = document.forms['theForm'];
                      formObject.submit();
                  }
                  </script>
                  </head>
                  <body>
                  <form name='theForm' id='theForm'>
                      <input type="radio" name="sort" <?php if ($sort == 'upload_time') { ?>checked='checked' <?php } ?>value="upload_time" onChange="autoSubmit();" />Recently Uploaded
                      <input type="radio" name="sort" <?php if ($sort == 'article') { ?>checked='checked' <?php } ?> value="article" onChange="autoSubmit();" /> Alphabetically
                      <input type="radio" name="sort" <?php if ($sort == 'year') { ?>checked='checked' <?php } ?> value="year" onChange="autoSubmit();" /> Most Recent
                  </form>
                  </body>
                  </html>
                  

                  这篇关于自动提交单选按钮,但保持选中状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何使用 Flask 通过 HTML 表单携带带空格的字符串 下一篇:创建一个可重用的 jQuery 函数

                  相关文章

                  <legend id='AITzv'><style id='AITzv'><dir id='AITzv'><q id='AITzv'></q></dir></style></legend>

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

                    <small id='AITzv'></small><noframes id='AITzv'>

                  2. <tfoot id='AITzv'></tfoot>
                    • <bdo id='AITzv'></bdo><ul id='AITzv'></ul>