87,910
社区成员
发帖
与我相关
我的任务
分享
function saveData(){
var errNames = [];
//try {
$(".frame1").each(function(){
if (this.value == "") {
var temp = $(this).parent().prev().text();
var name = temp.substring(1, temp.length);
errNames.push(e);
}
});
//} catch (e) {
//errNames.push(e);
//}
if (errNames.length) alert(e.join(',') + "不能为空!");
else {
document.form.action = "sss.do";
document.form.submit();
}
}
<script type="text/javascript">
<!--
function saveData(){
var oCount = 0;
var name="";
$(".frame1").each(function(){
if(this.value==""){
var temp = $(this).parent().prev().text();
if(name=="")
name = temp.substring(1,temp.length);
oCount ++;
}
}
)
if(oCount > 0){
alert(name+"不能为空!");
}
else{
document.form.action="sss.do";
document.form.submit();
}
}
//-->
</script>
function saveData(){
try {
$(".frame1").each(function(){
if (this.value == "") {
var temp = $(this).parent().prev().text();
var name = temp.substring(1, temp.length);
throw name;
}
});
} catch (e) {
alert(e + "不能为空!");
}
document.form.action = "sss.do";
document.form.submit();
}
function saveData(){
var errNames = [];
try {
$(".frame1").each(function(){
if (this.value == "") {
var temp = $(this).parent().prev().text();
var name = temp.substring(1, temp.length);
throw name;
}
});
} catch (e) {
errNames.push(e);
}
if (errNames.length) alert(e.join(',') + "不能为空!");
else {
document.form.action = "sss.do";
document.form.submit();
}
}
<script type="text/javascript">
<!--
function saveData(){
var oCount = 0;
$(".frame1").each(function(){
if(this.value==""){
var temp = $(this).parent().prev().text();
var name = temp.substring(1,temp.length);
oCount ++;
alert(name+"不能为空!");
}
}
)
if(oCount <= 0){
document.form.action="sss.do";
document.form.submit();
}
}
//-->
</script>