if(/.doc$/.exec(document.all.f1.value)==null)
{
alert("请选择doc文件");
return false;
}
<input type=file id=f1>