采用控件數組,提交時用js設置傳遞到一個指定的控件.
接收時接收指定的控件的數據http://www.luckyben.com/prod.jsp如
<script language="javascript">
function zxquerqy(){
var iCount = 0;
var strQuery = "";
var k=document.zxqry.chk_pid.length;
var qry="";
if(k==null){
if (document.zxqry.chk_pid.checked==true){
qry=document.zxqry.sel_qty.value;
if(qry==""){
alert("quantity can not is null,because you selected");
return ;
}
if(!/^[0-9]{1,5}$/.test(qry)){
alert("quantity must is integer");
return ;
}
iCount=1;
strQuery=document.zxqry.chk_pid.value +"," +qry;
}
}else{
for(i=0; i<k; i++){
if(document.zxqry.chk_pid[i].checked == true){
qry=document.zxqry.sel_qty[i].value;
if(qry==""){
alert("No:" + (i+1) +" row,quantity can not is null,because you selected");
return ;
}
if(!/^[0-9]{1,5}$/.test(qry)){
alert("No:" + (i+1) +" row,quantity must is integer");
return ;
}
iCount++;
if (strQuery!="") strQuery=strQuery + ",";
strQuery = strQuery + document.zxqry.chk_pid[i].value +","+ qry;
}
}
}
if(iCount==0){
window.alert("you have not select anyone product!");
return ;
}
document.zxqry.zxprod.value=strQuery;
//window.alert(document.zxqry.zxprod.value);
//javascript:window.open("prod_interest0.jsp");
document.zxqry.submit();
return true;
}
接收時接收指定的控件的數據http://www.luckyben.com/prod.jsp如
<script language="javascript">
function zxquerqy(){
var iCount = 0;
var strQuery = "";
var k=document.zxqry.chk_pid.length;
var qry="";
if(k==null){
if (document.zxqry.chk_pid.checked==true){
qry=document.zxqry.sel_qty.value;
if(qry==""){
alert("quantity can not is null,because you selected");
return ;
}
if(!/^[0-9]{1,5}$/.test(qry)){
alert("quantity must is integer");
return ;
}
iCount=1;
strQuery=document.zxqry.chk_pid.value +"," +qry;
}
}else{
for(i=0; i<k; i++){
if(document.zxqry.chk_pid[i].checked == true){
qry=document.zxqry.sel_qty[i].value;
if(qry==""){
alert("No:" + (i+1) +" row,quantity can not is null,because you selected");
return ;
}
if(!/^[0-9]{1,5}$/.test(qry)){
alert("No:" + (i+1) +" row,quantity must is integer");
return ;
}
iCount++;
if (strQuery!="") strQuery=strQuery + ",";
strQuery = strQuery + document.zxqry.chk_pid[i].value +","+ qry;
}
}
}
if(iCount==0){
window.alert("you have not select anyone product!");
return ;
}
document.zxqry.zxprod.value=strQuery;
//window.alert(document.zxqry.zxprod.value);
//javascript:window.open("prod_interest0.jsp");
document.zxqry.submit();
return true;
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货