How exactly do I link to a different website when the validation is true in javascript? I am struggling with working out the validation.
Asked
Active
Viewed 31 times
0
-
1what is "validation"? what is "linking"? what is "true"? – Dimava Nov 17 '22 at 19:40
-
function validate() { var username=document.getElementById("username").value; var password=document.getElementById("password").value; if (username=="admin"&& password=="user") { window.open("Reports.html") } else{ alert("Login Failed") } } – WombedHades Nov 17 '22 at 19:41
-
is https://stackoverflow.com/questions/503093/how-do-i-redirect-to-another-webpage an answer? – Dimava Nov 17 '22 at 19:43
-
that did not help – WombedHades Nov 17 '22 at 20:01
-
define "link to a different website" then – Dimava Nov 17 '22 at 20:03
-
i got it to work I did not put paranthesis in the html – WombedHades Nov 17 '22 at 20:25
1 Answers
1
if you want to locate to other page in javascript you can use window.location.replace("Reports.html")

Giorgi Shalamberidze
- 143
- 1
- 7
-
it is not going to the other html page it just stays in the login page – WombedHades Nov 17 '22 at 19:52
-
1