Return to Snippet

Revision: 6873
at June 22, 2008 18:16 by shanegriff


Initial Code
<html>
	<head>
		<script language="javascript">
			
			var secret_password = "jasmine";
			var entered_password = prompt("please enter password", " ");

			if (entered_password != secret_password)
			{
				document.write("incorrect");
			}
			else
			{
				document.write("welcome");
			}

		</script>
	</head>
	<body>

	</body>
</html>



<html>
	<head>
		<script language="javascript">
			
			var secret_password = "jasmine";
			var usernmae = "password";
			var entered_password = prompt("please enter password", " ");
			var entered_username = prompt("please enter username", " ");

			if ((entered_password == secret_password) && (entered_username == username))
			{
				document.write("correct");
			}
			else
			{
				document.write("try again");
			}

		</script>
	</head>
	<body>

	</body>
</html>



<html>
	<head>
		<script language="javascript">
			
			var admin = admin
			var developer = "mike";
			var user = "user";
			
			var entered_password = prompt("please enter password", " ");

			switch (entered_password)
			{
				case "admin": alert("you are admin"); break
				case "mike": alert("you are a developer"); break
				case "user": alert("you are a user"); break
				default: alert("password Incorrect!!"); break
			}

		</script>
	</head>
	<body>

	</body>
</html>

Initial URL

                                

Initial Description

                                

Initial Title
Javascript IF Statements

Initial Tags
javascript

Initial Language
JavaScript