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

    <tfoot id='lxTY8'></tfoot>

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

        打开页面的单选按钮

        Radio Button to open pages(打开页面的单选按钮)
            <tbody id='YoPa5'></tbody>

          • <bdo id='YoPa5'></bdo><ul id='YoPa5'></ul>

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

                <tfoot id='YoPa5'></tfoot>

                  <i id='YoPa5'><tr id='YoPa5'><dt id='YoPa5'><q id='YoPa5'><span id='YoPa5'><b id='YoPa5'><form id='YoPa5'><ins id='YoPa5'></ins><ul id='YoPa5'></ul><sub id='YoPa5'></sub></form><legend id='YoPa5'></legend><bdo id='YoPa5'><pre id='YoPa5'><center id='YoPa5'></center></pre></bdo></b><th id='YoPa5'></th></span></q></dt></tr></i><div id='YoPa5'><tfoot id='YoPa5'></tfoot><dl id='YoPa5'><fieldset id='YoPa5'></fieldset></dl></div>
                  <legend id='YoPa5'><style id='YoPa5'><dir id='YoPa5'><q id='YoPa5'></q></dir></style></legend>
                  本文介绍了打开页面的单选按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个带有 2 个单选按钮和一个提交按钮的表单.两个单选按钮都有不同页面的 url,比如一个会打开 google.com,另一个会打开 yahoo.com.已选择单选按钮并提交页面.我希望它打开我的网址.请帮忙.带有 HTML 和 javascript 代码.提前致谢.

                  i have a form with 2 radio buttons and a submit button. Both radio buttons have url of different pages, like one will open google.com and another will open yahoo.com. have selected a radio button and submit the page. i want it to open my url. Please help. with HTML and javascript code. Thanks in advance.

                  推荐答案

                  为自己节省 90k 额外脚本:

                  Save yourself 90k of extra script:

                  <script type="text/javascript">
                  
                    function doSubmit(form) {
                      var urls = form['url'];
                      var i = urls && urls.length;
                      while (i--) {
                        if (urls[i].checked) {
                          window.location = urls[i].value;
                        }
                      }
                      return false;
                    }
                  
                    </script>
                  
                    <form action="" onsubmit="return doSubmit(this)">
                      <input type="radio" name="url" value="http://www.google.com"> Google
                      <input type="radio" name="url" value="http://www.yahoo.com"> Yahoo
                      <input type="submit" value="Submit">
                    </form>
                  

                  哦,永远不要给表单控件命名为submit",因为它会掩盖表单的提交方法.如果必须,请将其命名为submitButton"或类似名称.

                  Oh, and never give a form control a name of "submit" as it will mask the form's submit method. If you must, name it "submitButton" or similar.

                  这篇关于打开页面的单选按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  keeping radio buttons checked after form submit(表单提交后保持选中单选按钮)
                  Styling radio button - not work in IE and Firefox(样式单选按钮 - 在 IE 和 Firefox 中不起作用)
                  Toggle HTML radio button by clicking its label(通过单击标签来切换 HTML 单选按钮)
                  Javascript how to change radio button label text?(Javascript如何更改单选按钮标签文本?)
                  JavaScript radio button confirmation(JavaScript 单选按钮确认)
                  How can I automatically select specific radio buttons with Greasemonkey?(如何使用 Greasemonkey 自动选择特定的单选按钮?)

                    • <bdo id='LOygU'></bdo><ul id='LOygU'></ul>
                      <legend id='LOygU'><style id='LOygU'><dir id='LOygU'><q id='LOygU'></q></dir></style></legend>
                        <tbody id='LOygU'></tbody>

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

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