Question: there is a html and a js code like this html code : 1234567890 * { padding: 0; margin: 0 } table { margin: 0

there is a html and a js code like this

html code :

1234567890

user login
user

pa ss wo rd

js code

//function to check the password

function check() {

//taking the value of username entered by user

var user_name = form1.user.value;

//taking password entered by user

var user_pwd = form1.pwd.value;

//checking user_name

if ((user_name == "") || (user_name == null)) {

//when username is empty or null

alert("enter username");//show message

form1.user.focus();//set focus on

return;

}//checking password

else if ((user_pwd == "") || (user_pwd == null)) {

//when user_pwd is empty or null

alert("enter password ");//show message

form1.pwd.focus();//set focus

return;

}

else if(user_name!="user1")

{

//when username is not valid

alert("enter valid username");

form1.user.focus();

return;

}

else if ((user_name == "user1") && (user_pwd != "12345678")) {

//when password is not valid

alert("enter valid password");

form1.user.focus();

return;

}

else if (user_name == "user1" && user_pwd == "12345678") {

//when username and password are valid

alert("you have successfully log in");

form1.submit();

window.open("21.html");//naviagte to the new page

}

}

-------------------------------------

how can i do to write a user.json .that saves some password and username

like username 123@234.com

password 123456

username 1231@2324.com

psword qwerty

......

andenter a incorrect username will result in the display of message Not a registered usernam, enteri a incorrect password will result in the display of message Invalid password if i do this successfully ,will go into a other webpage .

thanks.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!