You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

表单多提交按钮跳转不同页面问题:店主注册按钮跳转新HTML页面实现方案咨询

问题:点击「Sign up as Shop Owner」按钮无法跳转页面的解决方案

Hey there, let's fix that Shop Owner signup button redirect issue you're facing! The core problem here is your button is set as a type="submit" element — this triggers the form's default submission behavior, which overrides any link action you try to add. Here are three reliable solutions to get it working smoothly:


解决方案1:修改按钮类型并包裹在<a>标签中

Change the button's type from submit to button (so it won't trigger form submission), then wrap it in an <a> tag pointing to your target page:

<div class="mrgn-30-top">
  <a href="your-shop-owner-signup-page.html">
    <button type="button" class="btn btn-larger btn-block"> Sign up as Shop Owner </button>
  </a>
</div>

This way, clicking the button will trigger the link's redirect instead of trying to submit the form.


解决方案2:添加点击事件阻止表单提交并跳转

If you prefer keeping the submit type, add an onclick handler to stop the default form behavior and force a redirect:

<div class="mrgn-30-top">
  <button type="submit" class="btn btn-larger btn-block" onclick="event.preventDefault(); window.location.href='your-shop-owner-signup-page.html';"> Sign up as Shop Owner </button>
</div>
  • event.preventDefault() stops the form from submitting
  • window.location.href sends the user to your desired signup page

解决方案3:替换为样式化的<a>标签

Bootstrap's btn classes work perfectly on <a> tags — you can ditch the button entirely and use a styled link instead:

<div class="mrgn-30-top">
  <a href="your-shop-owner-signup-page.html" class="btn btn-larger btn-block"> Sign up as Shop Owner </a>
</div>

This maintains the button's visual style while acting as a normal link, with zero form submission interference.


内容的提问来源于stack exchange,提问作者Fardin Jim

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.27 13:12:41