我需要你的帮助。我有一个非常简单的问题,我无法弄清楚。它很难解释,但我在一行上有评论,希望你能理解。这是我的代码。很抱歉发了这么长的帖子,但我似乎无法摆脱这个洞。
function CheckLength()
{
var stringpassword = document.getElementById('Pass').value;
alert(document.getElementById('Pass').value); --> this part is only printing a blank.
/*
if(document.getElementById("Pass").value.length > 8)
{
return true;
}
else
{
alert(document.getElementById("Pass").value.length);
return false;
}
*/
}
function Check(a)
{
switch(a)
{
case 1 :
var first = document.getElementById("Uname").value.toUpperCase().indexOf(document.getElementById("Fname").value.toUpperCase());
var last = document.getElementById("Uname").value.toUpperCase().indexOf(document.getElementById("Lname").value.toUpperCase());
if(first !=-1 || last != -1)
{
alert("huy mali ang username. bawal yan pre");
document.getElementById("Uname").value = "";
}
break;
case 2 :
var gate = 0;
var first = document.getElementById("Pass").value.toUpperCase().indexOf(document.getElementById("Fname").value.toUpperCase());
var last = document.getElementById("Pass").value.toUpperCase().indexOf(document.getElementById("Lname").value.toUpperCase());
if(first !=-1 || last != -1)
{
alert("mali dahil sa name");
gate++;
}
if(!CorrectPassword())
{
gate++;
}
if(!CheckLength())
{
gate++;
}
if(gate != 0)
{
alert("Please follow password policy");
document.getElementById("Pass").value="";
}
break;
case 3:
if(document.getElementById("Pass").value != document.getElementById("Rpass").value)
{
document.getElementById("Rpass").value = "";
}
break;
}
}
身体某处:
<input type="Password" placeholder="Password" value="" id="Pass" onblur="Check(2)"/>
但是当我尝试时。在密码字段上键入后。然后单击其他内容。警报框仅返回一个空白警报框。即使是简单的赋值语句也不起作用?原谅我英语不好