本文介绍了验证Java脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
var fname = document.getElementById(''<%=txtFName.ClientID%>'').value;
var dob = document.getElementById(''<%=txtDob.ClientID%>'').value;
var mail = document.getElementById(''<%=txtMail.ClientID%>'').value;
var web = document.getElementById(''<%=txtWebsite.ClientID%>'').value;
var phone = document.getElementById(''<%=txtPhone.ClientID%>'').value;
var salary = document.getElementById(''<%=txtSalary.ClientID%>'').value;
var department = document.getElementById(''<%=drpDepart.ClientID%>'').value
var branch = document.getElementById(''<%=drbBranch.ClientID%>'').value
var error = "";
if (fname == "" && dob == "" && mail == "" && web == "" && phone == "") {
error = "Please Enter Following Details:";
if (fname == "") {
error += "\n Enter Employee FirstName.";
}
if (dob == "") {
error += "\n Enter Employee Date Of Birth.";
}
if (mail == "") {
error += "\n Enter Employee Email.";
}
if (web == "") {
error += "\n Enter Employee Website.";
}
if (salary == "") {
error += "\n Enter Employee Salary.";
}
if (department == "--Select--") {
error += "\n Select Employee Department.";
}
if (branch == "--Select--") {
error += "\n Select Employee Branch.";
}
alert(error);
}
else {
return true;
}
我正在输入FNAME文本框,但未显示错误,我该怎么办!!!!
推荐答案
if (fname == "" || dob == "" || mail == "" || web == "" || phone == "") {
这篇关于验证Java脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!