Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

150
Views
Link two websites with the onclick property?

I have a login page and a content page. Pressing the login button will open the content page in a new tab but I want it to open in the same tab. Tried window.location.href but it doesn't work for some reason.

function validate() {
  var username = document.getElementById("username").value;
  var password = document.getElementById("password").value;
  if (username == "marin" && password == "12345678") {
    window.open("file:///C:/Users/lukam/OneDrive/Radna%20povr%C5%A1ina/stranica/stranica1_1.html")
    return false;
  } else {
    alert("login je pogresan")
  }
}
<div>
  <label for="Username">Username</label>
  <input type="text" name="Username" id="username">
</div>
<div>
  <label for="password">Password</label>
  <input type="password" name="password" id="password">
</div>
<button type="submit" class="btn-submit" onclick="validate()">Login</button>

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!