为了账号安全,请及时绑定邮箱和手机立即绑定

如果我删除警报,Javascript 重定向不起作用

如果我删除警报,Javascript 重定向不起作用

皈依舞 2021-08-26 16:52:16
我有一个重定向页面的功能。当我有这样的代码时,函数工作得很好。document.getElementById("orderNow").addEventListener("click", function() {// window.location.href = "http://www.w3schools.com", "_blank";var name = document.getElementById("customerName").textContent;var address = document.getElementById("customerStreet").textContent;var city = document.getElementById("customerCity").textContent;var state = document.getElementById("customerState").textContent;var zip = document.getElementById("customerPcode").textContent;var country = document.getElementById("customerCountry").textContent;var phone = document.getElementById("customerPhone").textContent;window.location.href = "https://www.amazon.com/gp/buy/addressselect/handlers/display.html?hasWorkingJavascript=1";var username = document.getElementById('enterAddressFullName');alert(username);但是如果删除警报功能或这个:var username = document.getElementById('enterAddressFullName');重定向不起作用!我不知道如何命名问题,但这是我的问题。我不想要最后两行代码。帮我修
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 182 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信