0

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

<html>
<head>
<title>
Login page
</title>
</head>
<body background="black_background_metal_hole_very_small-wallpaper-2560x1600.jpg">
<h1 style="font-family:Comic Sans Ms;text-align="center";font-size:20pt;
color:#00FF00;>
<bR>
<center><font face="dodger" color="red">Welcome to Gamebook</font></center>
</h1>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<form name="login">
<h3><center><font face="dodger" color="red">Username:<input type="text" name="userid"/></font></center>
<br>
<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>
</form>
<script language="javascript">
function check(form)
{
if(form.userid.value == "yakuzajevin" || form.userid.value == "YAKUZAJEVIN" && form.pswrd.value == "yakuzajevin" || form.pswrd.value == "YAKUZAJEVIN")
{
window.open('file:///D:/WEBPAGE/redirect.html')
}
else
{
alert("Access Denied")
}
}
</script>
<SCRIPT LANGUAGE="JavaScript">
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.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}

document.oncontextmenu=new Function("return false")
</script>
<center><font face = " dodger " color = " red ">note: case sensitive!</font>
</body>
</html>
5
Contributors
7
Replies
34
Views
4 Years
Discussion Span
Last Post by YakuzaJevin
0

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

Edited by JorgeM

0

If you use:

window.location.assign('file:///D:/WEBPAGE/redirect.html');

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

0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.