我的代码中有一个错误,我找不到它。
var pass = prompt("Please enter your password");
var lung = pass.length;
var gutlng = 0;
document.getElementById("lungime").innerHTML =
"Your password has " + lung + " characters";
if(lung== 0 ){
document.getElementById("check").innerHTML = "Please enter a relevant password."
gutlng = 0;
}
if(lung== 1 ){
document.getElementById("check").innerHTML = "Please enter a relevant password."
gutlng = 0;
}
if(lung<8 && lung!=1 && lung!=0){
document.getElementById("check").innerHTML = "It is a bit to short. Please try again.";
gutlng = 0;
}
if(lung>8 && lung<20){
document.getElementById("check").innerHTML = "It is perfect! Proceed to the next step!"
gutlng = 1;
}
if(lung>20){
document.getElementById("check").innerHTML = "It is too long. PLease try again"
gutlng = 0;
}
var fb = 0;
var tw = 0;
var sc = 0;
var yh = 0;
var gm = 0;
var is = 0;
if(gutlng == 1){
var fb = 1;
var tw = 1;
var sc = 1;
var is = 1;
var yh = 1;
var gm = 1;
}
if(gutlng == 0){
var fb = 0;
var tw = 0;
var sc = 0;
var is = 0;
var yh = 0;
var gm = 0;
}
if(fb == 1){
document.getElementById("fb").innerHTML = "GOOD";
if(fb == 0){
document.getElementById("fb").innerHTML = "NOT GOOD";
}
if(tw == 1){
document.getElementById("tw").innerHTML = "GOOD";
}
if(tw == 0){
document.getElementById("tw").innerHTML = "NOT GOOD";
}
if(sc == 1){
document.getElementById("sc").innerHTML = "GOOD";
}
if(sc == 0){
document.getElementById("sc").innerHTML = "NOT GOOD";
}
if(is == 1){
document.getElementById("is").innerHTML = "GOOD";
}
if(is == 0){
document.getElementById("is").innerHTML = "NOT GOOD";
}
if(yh == 1){
document.getElementById("yh").innerHTML = "GOOD";
}
if(yh == 0){
document.getElementById("yh").innerHTML = "NOT GOOD";
}
if(gm == 1){
document.getElementById("gm").innerHTML = "GOOD";
}
if(gm == 0){
document.getElementById("gm").innerHTML = "NOT GOOD";
}
我试图修复它,但是这个bug并不适合。
答案 0 :(得分:1)
var pass = prompt("Please enter your password");
var lung = pass.length;
var gutlng = 0;
document.getElementById("lungime").innerHTML =
"Your password has " + lung + " characters";
if(lung== 0 ){
document.getElementById("check").innerHTML = "Please enter a relevant password."
gutlng = 0;
}
if(lung== 1 ){
document.getElementById("check").innerHTML = "Please enter a relevant password."
gutlng = 0;
}
if(lung<8 && lung!=1 && lung!=0){
document.getElementById("check").innerHTML = "It is a bit to short. Please try again.";
gutlng = 0;
}
if(lung>8 && lung<20){
document.getElementById("check").innerHTML = "It is perfect! Proceed to the next step!"
gutlng = 1;
}
if(lung>20){
document.getElementById("check").innerHTML = "It is too long. PLease try again"
gutlng = 0;
}
var fb = 0;
var tw = 0;
var sc = 0;
var yh = 0;
var gm = 0;
var is = 0;
if(gutlng == 1){
var fb = 1;
var tw = 1;
var sc = 1;
var is = 1;
var yh = 1;
var gm = 1;
}
if(gutlng == 0){
var fb = 0;
var tw = 0;
var sc = 0;
var is = 0;
var yh = 0;
var gm = 0;
}
if(fb == 1){
document.getElementById("fb").innerHTML = "GOOD";
}
if(fb == 0){
document.getElementById("fb").innerHTML = "NOT GOOD";
}
if(tw == 1){
document.getElementById("tw").innerHTML = "GOOD";
}
if(tw == 0){
document.getElementById("tw").innerHTML = "NOT GOOD";
}
if(sc == 1){
document.getElementById("sc").innerHTML = "GOOD";
}
if(sc == 0){
document.getElementById("sc").innerHTML = "NOT GOOD";
}
if(is == 1){
document.getElementById("is").innerHTML = "GOOD";
}
if(is == 0){
document.getElementById("is").innerHTML = "NOT GOOD";
}
if(yh == 1){
document.getElementById("yh").innerHTML = "GOOD";
}
if(yh == 0){
document.getElementById("yh").innerHTML = "NOT GOOD";
}
if(gm == 1){
document.getElementById("gm").innerHTML = "GOOD";
}
if(gm == 0){
document.getElementById("gm").innerHTML = "NOT GOOD";
}
答案 1 :(得分:0)
第一个问题是您没有关闭if(fb == 1){
声明。
添加一个结束括号,我认为这将解决你得到的语法错误。
答案 2 :(得分:0)
在声明
之后,你还没有关闭大括号if(fb == 1){
document.getElementById("fb").innerHTML = "GOOD";
应该是
if(fb == 1){
document.getElementById("fb").innerHTML = "GOOD";
}
我没有进一步检查是否有任何错误。希望是这样的。 如果有更多错误,我们很乐意帮助您:)
答案 3 :(得分:0)
<div class="cap">
<p class="textimp">Developed by VLAD</p>
<p id='lungime' class="textimp"></p>
<p id='check' class="textimp"></p>
</div>
<div class='poza'>
<p class='inviz'>d</p>
</div>
<div class='check'>
<p class='textimp'>FACEBOOK-</p><p class='textimp' id='fb'></p>
<p class='textimp'>TWITTER-</p><p class='textimp' id='tw'></p>
<p class='textimp'>SNAPCHAT-</p><p class='textimp' id='sc'></p>
<p class='textimp'>INSTAGRAM-</p><p class='textimp' id='is'></p>
<p class='textimp'>YAHOO-</p><p class='textimp' id='yh'></p>
<p class='textimp'>GMAIL-</p><p class='textimp' id='gm'></p>
</div>
编辑:这是我的身体