I'm new to javascript so I decided to make a login page. (Kinda bad login page-I'm sure there is an easier way but still).
The code is:
<script type="text/javascript">
var choice=prompt ("Enter 1 if you need to sign up. Enter 2 if you
need to sign in.");
if (var == 1)
{
var firstName=prompt ("What is your First Name?");
var secondName=prompt ("What is your Second Name?");
var userNameForSignUp=prompt ("What is your Username (for this
site)?");
var passWordForSignUp=prompt ("What is your Password (for this
site)?");
alert ("Thank You")+firstName;
document.write ("Your details are secured.")
}
else
{
var userName=prompt ("What is your Username (for this site)?");
var passWord=prompt ("What is your Password (for this site)?");
if (userName == userNameForSignUp)
}
alert ("Welcome! Head to the link displayed on the page.");
document.write ("(Well, whatever the sites address is)")
}
</script>
The problem being, when I save it as .html (which is what I do for all my projects so far) and open it nothing happens.
Help would be great.


Sign In
Create Account


Back to top









