开发者

JavaScript doesn't work in my frames?

I am making a homepage at the moment and I have made an edge around the "main page" with frameset... that was probably stupid, but now my JavaScript for some reason doesn't work?!

What I want to do is make a username and password protected page using javascript. The script itself is as follows:

function logIn(); {

var username = prompt("Skriv venligst dit brugernavn:" , "");

var password = prompt("Skriv venligst dit password:" , "");

var PassWords = new Array(46);
{
    PassWords[0] = "username:password";
    PassWords[1] = "username1:password1";
    PassWords[2] = "and_so_on:and_so_on";
}

for (i = 0; i < PassWords.length; i++)
{
    if (PassWords[i].indexOf(username) == 0)
    {
        var Split = koder[i].split(":");
        var UserName = Split[0];
        var PassWord = Split[1];
        if (username == UserName && password == PassWord)
        {
            alert("Access Granted")开发者_C百科
            window.location="access.htm";
        }
        else 
        {
            alert("Access Denied!")
            window.location="no_access.htm";
        }
    }
}

}

Please help me!! (: The link to the homepage is http://www.vestervang-dejret.dk/ - you probably won't understand it because it's danish but hover "Dokumenter" and select "Referater" and if you click the button you will see nothing happens... I've tried triggering the script with a button and the onload-event but nothing works! PLEASE HELP!


Remove the semicolon ";" after login()

JavaScript is seeing that as the end of statement, and not taking into account the function body. It's still valid JavaScript, but it's not a function definition.

function logIn() {

 var username = prompt("Skriv venligst dit brugernavn:" , "");

var password = prompt("Skriv venligst dit password:" , "");
// ... etc...
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜