Can someone help me with my codes about the log in using javascript, everytime i log in it opens a new window for the homepage, but i want it to be in the same window, thank you :D

Login page
<body background="black_background_metal_hole_very_small-wallpaper-2560x1600.jpg">
<h1 style="font-family:Comic Sans Ms;text-align="center";font-size:20pt;
<center><font face="dodger" color="red">Welcome to Gamebook</font></center>
<form name="login">
<h3><center><font face="dodger" color="red">Username:<input type="text" name="userid"/></font></center>
<center><font face="dodger" color="red">Password:<input type="password" name="pswrd"/></font></center></h3>
<center><input type="button" onclick="check(this.form)" value="Login"/>
<input type="reset" value="Cancel"/></center>
<script language="javascript">
function check(form)
if(form.userid.value == "yakuzajevin" || form.userid.value == "YAKUZAJEVIN" && form.pswrd.value == "yakuzajevin" || form.pswrd.value == "YAKUZAJEVIN")
alert("Access Denied")
var message="Please Log in!";
function clickIE() {if (document.all) {alert(message);return false;}}
function clickNS(e) {if 
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {alert(message);return false;}}}
if (document.layers) 

document.oncontextmenu=new Function("return false")
<center><font face = " dodger " color = " red ">note: case sensitive!</font>

If you want the web page to open in the same browser window use window.location() instead of

Also consider using jquery.

but when i used window.location() it wont work.

the window.location.replace() works, thank you for your replies :D

If you use:


The 'Back' button in your browser should still be active. I'm not sure if that is what you desire; otherwise, the options suggested by others will replace the current page with the new one.

Regards - Shawn

when i used window.location.assign, it ignores the value required for my password