![](/img/trans.png)
[英]How do I make specific inputs go into another .html file in the project?
[英]How Can I go to another HTML file
出于某种原因, document.location.href
、 window.location.href
和window.location.replace
无法正常工作,我现在使用的是 localhost,我不知道如何将其重定向到另一个网页。 我尝试在前面添加 http:// ,它仍然无法正常工作,我尝试将其重定向到另一个在线网站,它也没有工作。 我已经阅读了很多线程并尝试了它们,但它们都不适合我。
var loginBut = document.getElementById("RDbtn1");
loginBut.addEventListener("click", checklogin);
function check(){
document.location.href = "http://localhost/some/directory/here";
alert(document.location.origin + '/some/directory'); // I just use this to know that the button is being pressed.
}
html:
<!-- some code here-->
<li><button class="login1" id="RDbtn1">LOGIN</button></li>
<!-- some code here -->
我相信您应该重定向到特定的 html 页面,并且应该提供本地主机应用程序正在运行的端口
document.location.href = "http://localhost:8080/some/directory/here/file.html";
JavaScript 中的 window.location 和 document.location 有什么区别?
window.location = "/some/directory/here/index.html"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.