This is my code which was supposed to raise an alert
message if the textbox is left empty:
function a(id)
{
var n=document.getElementById(id).value;
if (n.length < 1)
{
window.alert("Field is blank");
return false;
}
}
The bug I'm getting is that the field is not getting verified onChange
the first time. But when the text box is filled with some data and erased, now the OnChange
fires, and the alert
message is displayed. How can I fix this bug?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…