展开全部
用循环判断,并加一个值input_all来判断:
<script language="javascript">
function foo(e) {
var input_cart=document.getElementsByTagName("INPUT");
var input_all=0;
for (var i=0; i<input_cart.length; i++) {
if (input_cart[i].type=="text" && input_cart[i].value!="") {
input_all=input_all+1;
//alert(input_all);
}
}
if (input_all==0)
{
alert("Please input one of the quantity of products that you want before you submit,thanks!");
return false;
}
}
</script>
<script language="javascript">
function foo(e) {
var input_cart=document.getElementsByTagName("INPUT");
var input_all=0;
for (var i=0; i<input_cart.length; i++) {
if (input_cart[i].type=="text" && input_cart[i].value!="") {
input_all=input_all+1;
//alert(input_all);
}
}
if (input_all==0)
{
alert("Please input one of the quantity of products that you want before you submit,thanks!");
return false;
}
}
</script>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询