var a1=document.getElementById("txtbx1");
if(a1.value!="")
{
alert('Enter Nam开发者_如何学Pythone!!!');
var lbl1=document.createElement("label");
var lblTitle1=document.createElement("label");
lblTitle1.innerHTML='Name:';
label.appendChild(lblTitle1);
var txt1=document.getElementById("txtbx1");
var txt11=txt1.value;
lbl1.innerHTML=txt11;
label.appendChild(lbl1);
}
Here I am comparing if the value of that text box is NULL, but it's wrong when it's deleted from form by user..so please help that how to write condition to check its deletion.
do it this way:
if (a1 == null)
{
/// ....
}
精彩评论