Forum Home
Press F1
 
Thread ID: 44135 2004-04-08 09:13:00 Javascript Question... csinclair83 (200) Press F1
Post ID Timestamp Content User
228018 2004-04-08 09:13:00 I have the following javascript
(i mite have missed abit to paste on here) but since i using frames for my website, i want this log on on the "side" using a small frame while the main website is using the rest of the IE window....anyway, my question is...when I log on the left side frame i want the resulting window to open up in a completely new window not the same window i logged in as which would mean a small side frame that has me logged in....so can someone tell me what i should change to get that to happen?


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=="n.a" && password=="password1") { window.location="member.html"; done=1; }
if (username=="n/a" && password=="password2") { window.location="member.html"; done=1; }
if (username=="n/a" && password=="password3") { window.location="member.html"; done=1; }
if (done==0) { alert("Invalid login!"); }


Many thanks :)
csinclair83 (200)
228019 2004-04-08 10:22:00 > my question is...when I log on the left side frame i
> want the resulting window to open up in a completely
> new window not the same window i logged in as which
> would mean a small side frame that has me logged
> in....so can someone tell me what i should change to
> get that to happen?

If I get what you mean correctly

Try this

> 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=="n.a" && password=="password1") {
> window.location="member.html target="left "; done=1; }
> if (username=="n/a" && password=="password2") {
> window.location="member.html target="left "; "; done=1; }
> if (username=="n/a" && password=="password3") {
> window.location="member.html target="left "; "; done=1; }
> if (done==0) { alert("Invalid login!"); }

Note: this has not been tested, so I am not too sure if it will work or not, but give it a try & let me know how you get on.

If that does Not help, come on MSN messenger (stuartw77 [at] hotmail [ dot ] com & I can help you there move, or just reply below :)
stu140103 (137)
228020 2004-04-08 10:23:00 > If that does Not help, come on MSN messenger
> (stuartw77 [at] hotmail [ dot ] com & I can help you
> there more, or just reply below :)
stu140103 (137)
228021 2004-04-08 11:28:00 Ok, I tried helping csinclair83 here, but it did not work :( :_|

I will try to explain what he wants this JavaScript to do

He has a two frame website, & on the left frame he has a login box for people to login to his site

Now what he wants the java script to do is so that when people login they get a popup window (or in other words a new window), instead of the page loading in the right frame

Here is the login code he is using

<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=="n.a" &amp;&amp; password=="password1") { window.location="member.html"; done=1; }

if (username=="n/a" &amp;&amp; password=="password2") { window.location="member.html"; done=1; }

if (username=="n/a" &amp;&amp; password=="password3") { window.location="member.html"; done=1; }

if (done==0) { alert("Invalid login!"); }</font>

}
// End -->
//-->
</SCRIPT>

does any one has any idea?

Hope some one can help csinclair83 here :)
stu140103 (137)
228022 2004-04-08 11:52:00 Chris and Stu
this may help you, instructions on how to setup Gatekeeper (javascript password protection (not very secure)) in frames here (www.pagetutor.com)

Please if you are going to use javascript remember a right click revals all and even a dsiable right click script can be worked round.
beama (111)
228023 2004-04-08 18:50:00 Hey csinclair83,

Well I can show you new ideas, but not specifically for frames, it's just I never liked frames. But I hope this code is in the right direction of what you want.


<script language="javascript">
<!--
function Start(url) {
OpenWin = this.open(url);
}
function Login() {
var done = 0;
username=prompt('Please enter your username:','');
password=prompt('Please enter your password:','');

if(username == "n.a" && password == "password1") {
Start('member.html');
done = 1;
}
if(username == "n/a" && password == "password2") {
Start('member.html');
done = 1;
}
if(username == "n/a" && password == "password3") {
Start('member.html');
done = 1;
}
if(done == 0) {
alert("Invalid login!");
}
}
//-->
</script>
login (javascript:Login())



Noel Nosivad
Noel Nosivad (389)
228024 2005-02-08 00:07:00 If you want the users to click login, and up come a new window re-write the code to match this . . .

Change this part of the code from:

if (username=="member1" && password=="password1") { window . location="page1 . html"; done=1; }

to:

if (username=="member1" && password=="password1") { window . open(" . com/"" target="_blank">blah . com); done=1; }
golfb88 (5497)
1