开发者社区> 问答> 正文

选择不同的radio,submit按钮就指向到不同的url

请问选择不同的radio,点击submit按钮就指向到不同的url。。

<form name="create" action="http://www.buffalobillsjerseysstore.com/index.php?main_page=create_account" method="post" id="account">            <p>Checkout Options:</p>
            <label style="cursor: pointer;" for="register">
                            <input type="radio" checked="checked" id="register" value="register" name="account">
                            <b>Register Account</b></label>
            <br>
                        <label style="cursor: pointer;" for="guest">
                            <input type="radio" id="guest" value="guest" name="account">
                            <b>Guest Checkout</b></label>
            <br>
            <p>By creating an account you will be able to shop faster, be up to date on an order's status, and keep track of the orders you have previously made.</p>
            <div style="text-align: right;"><a class="button" onclick="$('#account').submit();"><input type="image" src="includes/templates/Fnflbills/buttons/english/button_submit.gif" alt="Continue" title=" Continue " name="registrationButton" /></a></div>
          </form>

这个是onclick 里面的jq代码要如何操作呢?

展开
收起
a123456678 2016-07-06 16:50:14 2214 0
1 条回答
写回答
取消 提交回答
  • function accountSubmit(){ 
      var submitType = $("input[name='account']").val();
      if(submitType=='register'){
        $('#account').attr('action','http://www.buffalobillsjerseysstore.com/index.php?main_page=create_account');
      }else if(submitType=='guest'){
        $('#account').attr('action','http://www.buffalobillsjerseysstore.com/index.php?main_page=guest_account');
      }
      $('#account').submit();
    }
    2019-07-17 19:52:19
    赞同 展开评论 打赏
问答标签:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载