JavaScript Javascript IF语句
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了JavaScript Javascript IF语句相关的知识,希望对你有一定的参考价值。
<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>
以上是关于JavaScript Javascript IF语句的主要内容,如果未能解决你的问题,请参考以下文章
JavaScript
Javascript Statement(上)
利用JavaScript实现不同时间 显示不同问候语
输入框聚焦隐藏提示语
“云”端的语雀:用 JavaScript 全栈打造商业级应用
“云”端的语雀:用 JavaScript 全栈打造商业级应用