PopUP与动态文本框

时间:2013-10-31 08:27:06

标签: html jsp dynamic popup

我正在尝试打开一个弹出窗口并创建包含动态文本框的表格。我正在父窗口中引用此弹出窗口并编写元素。我无法访问在文本框中输入的数据。任何人都可以帮助我

这是代码

function loadValues31() {

popupWin = window.open('','popupWin','location=no,width=800,height=200');
popupWin.document.writeln('<html><head><title>POPUP</title><script>function ind(){pop=document.getElementById("dynamicTable1");var v = pop.tbody.getElementsbyTagName("rad"); var c=v[1]; alert(c);}</scr'+'ipt>'+'</head><body><form1><tr> <td colspan=6><table id="dynamicTable1" width="100%" border="0" cellspacing="1" cellpadding="1"><TBODY><tr id="dynamicRow1[0]"><TD width="60%" nowrap="true"><FONT size=2><strong>Election Date -- Name:</STRONG></font></TD><TD  width="20%" nowrap="true"> <FONT size=2><strong>Election Type:</STRONG></font></TD><TD  width="20%" nowrap="true"> <FONT size=2><strong>Election Category:</STRONG></font></TD><TD  width="20%" nowrap="true"> <FONT size=2><strong>Select:</STRONG></font></TD></tr></form1></body></html>');
popupWin.document.close(); 
popupText = popupWin.document.getElementById("dynamicTable1");
var x=form1.el.selectedIndex;   
var ref=window.dialogArguments;

if(x>0)
    {
        var j=strConsolidate[x].length;
        strElection=new Array(j);
        for(var k=0;k<j;k++)
            {
                     strElection[k]=strConsolidate[x][k];
                     var strAr=str[k].split("#");
                     index=eval(k+1);
                     var tbody = popupText.getElementsByTagName("tbody")[0]; 
                     var row = popupText.document.createElement("TR"); 
                     var attrVal="popupText.dynamicRow1[" + index + "]";
                     row.setAttribute("id",attrVal);

                     var cell = popupText.document.createElement("TD"); 
                     var attrVal0="left"; 
                     cell.setAttribute("align",attrVal0);       
                     cell.innerHTML= strAr[0];

                     var cell1 = popupText.document.createElement("TD");
                     var attrVal1="left"; 
                     cell1.setAttribute("align",attrVal1);
                     cell1.innerHTML=strAr[1];

                    var cell2 = popupText.document.createElement("TD"); 
                    var attrVal2="left";
                    cell2.setAttribute("align",attrVal2);
                    cell2.innerHTML=strAr[2];


                    var cell3 = popupText.document.createElement("TD"); 
                    var cell5 = popupText.document.createElement("input"); 
                    var attrVal3="left";
                    var attrVal4="text";
                    var attrVal5="rad";
                    cell5.setAttribute("type",attrVal4);
                    cell5.setAttribute("name",attrVal5);
                    cell5.setAttribute("align",attrVal3);
                    cell3.appendChild(cell5);


                    row.appendChild(cell); 
                    row.appendChild(cell1); 
                    row.appendChild(cell2); 
                    row.appendChild(cell3); 
                    tbody.appendChild(row);

            }   

                     index=eval(k+1);
                     var tbody = popupText.getElementsByTagName("tbody")[0]; 
                     var row = popupText.document.createElement("TR"); 
                     var attrVal="popupText.dynamicRow1[" + index + "]";
                     row.setAttribute("id",attrVal);

                     var cell1 = popupText.document.createElement("TD");
                     var attrVal1="right"; 
                     cell1.setAttribute("align",attrVal1);
                     cell1.innerHTML='<INPUT type="button" value="SELECT" onclick="ind()" >';

                    row.appendChild(cell1); 
                    tbody.appendChild(row);

    } 
    }

0 个答案:

没有答案