模态窗口的使用步骤【总结】

模态窗口的使用步骤【总结】
1.  x.jsp


function open(form)
{
        var apply_id=form.flag.value;
        var srcFile = "/uniframework/configuration.action?actName=applyToDistribut&flag="+apply_id;
        var winFeatures = "dialogWidth=850px;dialogHeight=550px;status=no;help=no;";
        var seleItemValue='';
        var checkbox = form.checkbox;
        if(checkbox){
       
        if(checkbox.length)
        {
         for(var i=0;i<checkbox.length;i++)
         {
          if(i==0)seleItemValue = form.checkbox[i].value;
          else
          seleItemValue+=","+form.checkbox[i].value;
         }
        }else
        {
         seleItemValue = form.checkbox.value;
        }
        }

        var obj = form1;
        var ret = window.showModalDialog(srcFile, seleItemValue, winFeatures);

        if(ret!=undefined){
         addCTItemToTable(ret);
        }
       
}
function addCTItemToTable(data)
{
 var tableobj = document.getElementById("CTTable");
 var appli_id="";
 if (tableobj != null)
 {
     for(var k=0;k<data.length;k++)
        {
            var st=data[k];
            appli_id=st[7];
            var newRow = tableobj.insertRow(tableobj.rows.length);
   c1 = newRow.insertCell(0);
   c1.innerHTML = "&nbsp;&nbsp;&nbsp;&nbsp;<input type=checkbox name=checkbox checked class=checkbox1 value='"+st[0]+"'>&nbsp;&nbsp;";
   c2 = newRow.insertCell(1);
   c2.innerHTML = '<div align=\"center\">' + st[1] + '</div>';
   c3 = newRow.insertCell(2);
   c3.innerHTML = '<div align=\"center\">'+st[2]+'</div>';
   c4 = newRow.insertCell(3);
   c4.innerHTML = '<div align=\"center\">'+st[3]+'</div>';
   c5 = newRow.insertCell(4);
   c5.innerHTML = '<div align=\"center\">'+st[4]+'</div>';
   c6 = newRow.insertCell(5);
   c6.innerHTML = '<div align=\"center\">'+st[5]+'</div>';
   c7 = newRow.insertCell(6);
   c7.innerHTML = '<div align=\"center\">'+st[6]+'</div>'
        }
    }
}

2.y.jsp

function addCTItemReturnT(form)
{

    applyid=form.info3.value;
 var check= form.checkbox;
 var arr=new Array();
    var string="";
    var index=0;
 if(check.length)
 {
  for(var i=0;i<check.length;i++)
  {
       var checkval = check[i];
     
             if(checkval.checked)
             {
                   var row = checkval.parentElement.parentElement;
                   var data=[];
                   data[0] = checkval.value;//产品型号;
                   data[1] = form.ASSET_CODE[row.rowIndex -1].value;//资产编码
       data[2] = form.PROJECTNO[row.rowIndex -1].value;//项目编号
       data[3] = form.CI_NAME[row.rowIndex -1].value;// 配置项名
       data[4] = form.RESPONSIBILITY[row.rowIndex -1].value;//责任人
       data[5] = form.KEEPER[row.rowIndex -1].value;//使用人
       data[6] = form.PRODUCT_MODLE[row.rowIndex -1].value;//产品型号
       data[7] = applyid;//产品型号
                   arr[index]=data;
                   index++;
             }
            
  }
 }
    for(var k=0;k<arr.length;k++)
    {
          var st=arr[k];
          //alert("---"+st[0]+"::"+st[3]);
    }
 window.returnValue=arr;
 window.close();
}

你可能感兴趣的:(模态窗口的使用步骤【总结】)