我有一個重定向頁面的功能。當我有這樣的代碼時,函數(shù)工作得很好。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');重定向不起作用!我不知道如何命名問題,但這是我的問題。我不想要最后兩行代碼。幫我修
如果我刪除警報,Javascript 重定向不起作用
皈依舞
2021-08-26 16:52:16