下面是一个代码片段,我们在其中检索表单值。在进一步处理之前,请检查该值是否不为null。
var val = document.FileList.hiddenInfo.value;
alert("val is " + val); // this prints null which is as expected
if (val != null)
{
alert("value is "+val.length); // this returns 4
}
else
{
alert("value* is null");
}
任何想法为什么会这样发生。