这我的网络电子邮件表单上有四个下拉菜单,如下所示
<select name="newstaff" class="formStyle" style="width:335px;" >
<option value="N/A">Please Select</option>
---- other options ---
<select name="allstaff" class="formStyle" style="width:335px;" >
<option value="N/A">Please Select</option>
---- other options ---
<select name="learning" class="formStyle" style="width:400px;" >
<option value="N/A">Please Select</option>
---- other options ---
<select name="leaders" class="formStyle" style="width:335px;" >
<option value="N/A">Please Select</option>
---- other options ---
如果用户尝试提交此表单而不从至少一个下拉菜单中选择至少一个其他选项,我将如何编写一个会发出警报的验证函数“N/A
谢谢
编辑:
用于验证表单的代码:
function validateForm(objForm)
{
var returnStatus = 1;
if (objForm.newstaff.selectedIndex == 0) {
alert("please make a selection!");
returnStatus = 0;
};
if (returnStatus) {
objForm.submit();
}
}