(Edited)If i copy the code from the answer given bellow from a different user it works perfectly in a new black html file.Something must be going on with my code not allowing the redirection to happend.I will include some of the html/css of the program
<header class='header'>
<title>Εγγραφή</title>
<link rel="stylesheet" type="text/css" href="mystyle.css" >
<center><img src="logo.png" alt="LOGO" height=100></center>
</header>
<div class="text">
<p style="font-family: system-ui; font-size: 15pt;">
<label for="onoma" style="font-size:15pt;">Διεύθυνση*:</label>
<input id="address" type="text" name="address" value="" >
<p style="font-family: system-ui; font-size: 15pt;">
<div class="text">
<label for="mera" style="font-size:15pt;">Συνθηματικό πρόσβασης*:</label>
<input id="password" type="password" name="mera" value="" >
<label for="minas" style="font-size:15pt;">Κωδικός πρόσβασης*:</label>
<input id="password2" type="password" name="minas" value="" >
div align="center">
<input type="reset" value="Reset">
<input type="submit" id="btn" value="submit">
</div>
<br><br> <br><br>
<script type="text/javascript" src="java.js"></script>
CSS
body {
margin: 0;
font-family: system-ui
}
.logocolor {
background-color:cornflowerblue;
}
.background{
background-color:wheat;
}
header {
background-color: rgb(0, 132, 255);
}
.text{
text-align:left;
text-indent: 150px;
}
label {
font-family: system-ui
}
.change{
display: flex;
}
Also the current java
function CheckPassword(address, password, password2) {
if (password === "" || password2 === "" || address === "") {
alert("Καποιο/Καποια κενά δεν συμπληρώθηκαν σωστά ή ειναι κενά")
} else {
alert('message');
window.location = 'newpage.html';
}
}
function ClickMe() {
CheckPassword(
document.getElementById('address').value,
document.getElementById('password').value,
document.getElementById('password2').value
);
}
document.getElementById('btn').addEventListener("click", function() {ClickMe()});
bracket
– Andrew Sempros Dec 03 '22 at 23:10