www.webdeveloper.com
Results 1 to 9 of 9

Thread: Target="frame" in a script

  1. #1
    Join Date
    Feb 2011
    Posts
    6

    Target="frame" in a script

    This is a question about the script "Multiple Users (Promt) on http://javascript.internet.com/passwords/

    How do I target the file in a frame??

    Here is the script: I would be really happy if somebody could help me.
    -----------------------------------------------------------------------
    <!-- STEP ONE: Add code to HEAD of login HTML document -->

    <HEAD>

    <SCRIPT LANGUAGE="JavaScript">
    <!-- Begin
    function LogIn(){
    loggedin=false;
    username="";
    password="";
    username=prompt("Username:","");
    username=username.toLowerCase();
    password=prompt("Password:","");
    password=password.toLowerCase();
    if (username=="guest" && password=="login") {
    loggedin=true;
    window.location="home-page.html";
    }
    if (username=="guest2" && password=="login2") {
    loggedin=true;
    window.location="home-page2.html";
    }
    if (loggedin==false) {
    alert("Invalid login!");
    }
    }
    // End -->
    </SCRIPT>

    <!-- STEP TWO: Put this code in BODY of your HTML document -->

    <BODY>

    <center>
    <form><input type=button value="Login!" onClick="LogIn()"></form>
    </center>

  2. #2
    Join Date
    Feb 2011
    Location
    Sapporo, Hokkaido, Japan
    Posts
    180
    Do you mean target the parent or something more difficult?

    Code:
    <a href="http://a4jp.com/index-en.html" target="_parent">a4jp.com</a>
    Code:
    target="_parent"
    Regards,

    Glen R
    http://a4jp.com/index-en.html

  3. #3
    Join Date
    Feb 2011
    Posts
    6

    Reply

    Well, the script works perfect but the password protected webpage opens in a new window.

    "username=prompt("Username:","");
    username=username.toLowerCase();
    password=prompt("Password:","");
    password=password.toLowerCase();
    if (username=="guest" && password=="login") {
    loggedin=true;
    window.location="home-page.html"; <<< Here I would like it to open in my
    within my frame.


    Can you help?

  4. #4
    Join Date
    Feb 2011
    Location
    Sapporo, Hokkaido, Japan
    Posts
    180
    What is the address of your website?

    Do you have and id set for that frame? you could try adding the id.

    Glen
    http://a4jp.com/index-en.html

  5. #5
    Join Date
    Feb 2011
    Posts
    6

    Reply 2

    What do you mean with id?
    www.incustos.se is the site. To the right you have "Logga in", there is the script but it opens in a new window and I want it in the frame.

  6. #6
    Join Date
    Feb 2011
    Location
    Sapporo, Hokkaido, Japan
    Posts
    180
    Do you mean you just want a text box where you can type in the password to appear on the page, when you press the "Logga in" button?

    Glen R
    http://a4jp.com/index-en.html

  7. #7
    Join Date
    Feb 2011
    Posts
    6

    Reply 3

    When you click on the "Logga in" -button you are asked by promt and that is correct. But try to write admin as "användarnamn" and "admin as "lösenord when you select the "Logga in" -button. The result is that you are taken to correct page BUT in a new window instead of inside the parentframe!

  8. #8
    Join Date
    Feb 2011
    Location
    Sapporo, Hokkaido, Japan
    Posts
    180
    I'm using Google Chrome and the page loads in the frame but the page is missing. Also the page loads sooooooo slowly. Is there a way to speed everything up on your side?

    Code:
    This webpage is not available
    The webpage at http://www.incustos.se/frame.htm might be temporarily down or it may have moved permanently to a new web address.
    Here are some suggestions:
    Reload this web page later.
    Error 101 (net::ERR_CONNECTION_RESET): The connection was reset.
    Have you uploaded http://www.incustos.se/frame.htm ?

    Maybe you just forgot the L in xxxx.html.

    Regards,

    Glen R
    http://a4jp.com/index-en.html

  9. #9
    Join Date
    Feb 2011
    Location
    Sapporo, Hokkaido, Japan
    Posts
    180
    I just checked the code inside the page in the frame and it is just missing an L.

    Code:
    if (username=="admin2" && password=="admin2") {
    
    loggedin=true;
    
    window.location="anv/admin.htm";
    
    }
    Regards,

    Glen R
    http://a4jp.com/index-en.html

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles