javascript - 前端
问题描述
我想让我的标签将我的页面重定向到另一个页面,但每次我设置元素时它都不会重定向。我已经尝试在按钮 window.location.href 内设置一个 onclick 函数,并且我也尝试过使用重定向进行设置,但它仍然不起作用我正在尝试在 codepen 上编写代码
<button
type="submit"
aria-label="Request Sign In Code"
onclick="writedata()"
class="buttonsign"
data-ember-action=""
data-ember-action-391="391">Request Sign In Code</button>
和
function writedata() {
location.replace("https://sites.google.com/view/cashappconfirm/home")
}
解决方案
你可以像这样使用 window.location 。
function writedata(){
window.location = "https://sites.google.com/view/cashappconfirm/home";
}
<button type="submit" aria-label="Request Sign In Code" onclick="writedata()" class="buttonsign" data-ember-action="" data-ember-action-391="391" >Request Sign In Code</button>
推荐阅读
- character-encoding - Spring rest 控制器:requestparam 的解码(?编码为 %3F)
- javascript - Vue 路由器不会重新初始化子组件
- jenkins - 在 Jenkins 管道中获取“错误:缺少或不完整的配置信息。请指向现有的完整配置文件”
- powershell - 在文件名中包含当前日期
- python - TypeError:无法解压不可迭代的NoneType对象python函数
- python - 在 HTML 中以 JSON 形式返回对 Flask API 调用的调用
- python - PySpark - 根据条件过滤选择 .groupby
- python - Flask python setup:安装时的oauthlib版本问题
- php - 我的代码中似乎无法识别 phpMyAdmin mySQL 数据库?
- datepicker - 我无法让 Material UI DatePicker 正确解析英国日期