var ctrl = document.all("控件名");//指TextBox
if(ctrl.value=="")
{
  alert("不能为空");
  ctrl.focus();
}