我有以下驗證表單,要求某人完成表單上的所有相關塊。我試圖讓一個Block只有那個特定塊的最少字符數。下面是我當前的代碼具有最小字符要求的表單
<script>
function validateForm()
{
var a=document.forms["lbs_trace"]["lbs_reason"].value;
var b=document.forms["lbs_trace"]["lbs_for"].value;
var c=document.forms["lbs_trace"]["lbs_type"].value;
var x=document.forms["lbs_trace"]["lbs_case"].value;
var y=document.forms["lbs_trace"]["lbs_terms"].value;
var count = 0;
if (!(a==null|| a==""))
{
count++;
}
if (!(b==null|| b==""))
{
count++;
}
if (!(c==null|| c==""))
{
count++;
}
if (!(x==null || x==""))
{
count++;
}
if (!(y==null || y==""))
{
count++;
}
if(count < 5){
alert("Please assure that the following has been completed, CASE TYPE, REQUESTED BY, DESCRIPTION, CASE NUMBER and TERMS AND CONDITIONS ARE TICKED");
return false;
}
}
</script>
在VAR一個我想30個字符分鐘繼續處理表單前輸入
在Javascript中驗證不是PHP? – iyop45
@ user1一個不妨礙其他;) – Kilazur