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

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

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

                  相关文档推荐

                  在开发JS过程中,会经常遇到两个小数相运算的情况,但是运算结果却与预期不同,调试一下发现计算结果竟然有那么长一串尾巴。如下图所示: 产生原因: JavaScript对小数运算会先转成二进制,运算完毕再转回十进制,过程中会有丢失,不过不是所有的小数间运算会
                  问题描述: 在javascript中引用js代码,然后导致反斜杠丢失,发现字符串中的所有\信息丢失。比如在js中引用input type=text onkeyup=value=value.replace(/[^\d]/g,) ,结果导致正则表达式中的\丢失。 问题原因: 该字符串含有\,javascript对字符串进行了转
                  Rails/Javascript: How to inject rails variables into (very) simple javascript(Rails/Javascript:如何将 rails 变量注入(非常)简单的 javascript)
                  CoffeeScript always returns in anonymous function(CoffeeScript 总是以匿名函数返回)
                  Ordinals in words javascript(javascript中的序数)
                  getFullYear returns year before on first day of year(getFullYear 在一年的第一天返回前一年)

                    • <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>