Results 1 to 7 of 7
  1. #1
    csinclair83
    Guest

    Default Javascript Question...

    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

  2. #2
    stu140103
    Guest

    Default Re: Javascript Question...

    > 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

  3. #3
    stu140103
    Guest

    Default Re: Javascript Question...

    > If that does Not help, come on MSN messenger
    > (stuartw77 [at] hotmail [ dot ] com & I can help you
    > there more, or just reply below


  4. #4
    stu140103
    Guest

    Default Re: Javascript Question...

    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

  5. #5
    beama
    Guest

    Default Re: Javascript Question...

    Chris and Stu
    this may help you, instructions on how to setup Gatekeeper (javascript password protection (not very secure)) in frames here

    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.

  6. #6
    Noel Nosivad
    Guest

    Default Re: Javascript Question...

    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.

    [pre]
    <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
    [/pre]


    Noel Nosivad

  7. #7
    Computer Master
    Join Date
    Feb 2005
    Location
    Zion
    Posts
    1

    Default How to make it come up in a new window...

    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("http://blah.com/"); done=1; }
    Last edited by golfb88; 08-02-2005 at 01:09 PM.

Similar Threads

  1. javascript updating page, Javascript help
    By Morgenmuffel in forum PressF1
    Replies: 3
    Last Post: 29-06-2006, 04:05 PM
  2. javascript question
    By shishir in forum PressF1
    Replies: 1
    Last Post: 24-02-2005, 11:28 AM
  3. JavaScript Question
    By CreightonBrown in forum PressF1
    Replies: 1
    Last Post: 20-02-2005, 02:08 PM
  4. JavaScript question
    By aNtzy in forum PressF1
    Replies: 0
    Last Post: 28-10-2003, 09:09 AM
  5. Replies: 2
    Last Post: 01-07-2001, 09:42 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •