It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming JavaScript Forum

Open in New Window

Open in New Window

Postby sprockt012 on Thu May 15, 2008 2:24 pm

I have the script below embedded in an HTML page and I need to have the resulting window open in a new page. Right now, when someone logs in, it just replaces that page. Help! What am I doing wrong???


<SCRIPT LANGUAGE="JavaScript">

<!-- Begin
function Login(){
var done=0;
var username=document.login.username.value;
username=username.toLowerCase();
var password=document.login.password.value;
password=password.toLowerCase();
if (username=="brenna" && password=="hansen") { window.open=("http://www.ggbportal.com/~... done=1; }
if (username=="meaghan" && password=="emmons") { window.open=("http://www.ggbportal.com/~... done=1; }
if (done==0) { alert("Invalid login!"); }
}
// End -->
</SCRIPT>
sprockt012
 
Posts: 0
Joined: Thu May 15, 2008 2:22 pm

Postby rangana on Fri May 16, 2008 12:36 am

First, language is a deprecated attribute :(

Secondly, you use window.open() in the wrong way.

Thirdly, you haven't closed your window.open (in your code) which in the first place is erroneous.

...Also, your if statement is erroenous :(

Give this code a try, see if it helps ;)
Code: Select all
<SCRIPT type="text/javascript">

<!-- Begin
function Login(){
var done=0;
var username=document.login.username.value;
username=username.toLowerCase();
var password=document.login.password.value;
var confpassword=password.toLowerCase();
if ((username=="brenna") && (confpassword=="hansen"))
{
done=1;
window.open("http://www.ggbportal.com/~... done=1;");
}
else if ((username=="meaghan") && (password=="emmons"))
{
done=1;
window.open("http://www.ggbportal.com/~... done=1;");
}
if (done==0) { alert("Invalid login!"); }
}
// End -->
</SCRIPT>
User avatar
rangana
500+ Club
 
Posts: 935
Joined: Wed Feb 27, 2008 5:14 am
Location: Cebu City Philippines


Who is online

Users browsing this forum: No registered users and 8 guests