Error screenshot:
screenshot content translation: the parameter quoted on the left is an error.
Screenshot of error code:
Reason for error:
user="zhousujuan"&&pass="12345678"
The wording is incorrect. It should be written user=="zhousujuan"&&pass=="12345678"
.
No error is reported after the change. The program runs normally.
Code after change:
<script>
//先弹窗,并获取用户初始输入的账号名和密码
var user=prompt("请输入用户名:");
var pass=prompt("请输入密码:");
//放在while中判断,如果判断失败,则继续弹窗,弹窗完成继续判断,直到密码输入正确为止
while(!(user=="zhousujuan"&&pass=="12345678")){
var user=prompt("请输入用户名:");
var pass=prompt("请输入密码:");
}
alert("成功");
</script>
Screenshot of successful operation after the change: