if(form.select1.options[0].text== " "){
alert( "提示信息 ");
form.select1.focus();
return false;
}
为何无效,或者代码不对,请帮忙修改!
------解决方案--------------------
判断第一项内容为空:document.getElementById( "select1 ").options[0].text == " "
判断整个下拉框为空:document.getElementById( "select1 ").options.length == 0
------解决方案--------------------
document.getElementById( "select1 ").length == 0
------解决方案--------------------
var sel=document.getElementById( "select1 ");
if(sel.value== " "){
alert( "提示信息 ");
sel.focus();
return false;
}