第一步:
修改 /templets/plus/post_diyform.htm 添加以下代码(建议放到body标签里、form后边):
<script type="text/javascript" src="/images/js/j.js"></script>
<script type="text/javascript">
function chk(){
var checked = true;
if(checked){
$('#form input').each(function(i,e){
if($(this).val() == ''){
var tip = $(this).parents('tr').children('td').eq(0).html().replace(':','');
alert('请填写 '+tip+' !');
$(this).focus();
checked = false;
return false;
}
});
}
if(checked){
$('#form textarea').each(function(i,e){
if($(this).val() == ''){
var tip = $(this).parents('tr').children('td').eq(0).html().replace(':','');
alert('请填写 '+tip+' !');
$(this).focus();
checked = false;
return false;
}
});
}
if(checked){
return true;
}else{
return false;
}
}
</script>
第二步:
给form添加 onsubmit=”return chk();”
<完>