Javascript/Dom issue



我大约在10年前开发了一个javascript代码,但现在它还不流行。它无法获取表行的子节点的id和文本。任何人请帮助

function MoveGridToForm(pDocObj,pFormName,pTableRowId)
{ 
var mRowId=pTableRowId.substring(7,pTableRowId.length);
if (pFormName.substring(0,3)!='frm') pFormName='frm'+pFormName;

var mTableName='Tbl'+pFormName.substring(3,pFormName.length);
var mRowObj=pDocObj.getElementById(mTableName).rows[mRowId]; //

// ShowForm("TableRow","ER");
// var x=Control('TblComCodes').rows[mRowId].cells;
**var mCellsofRow=mRowObj.cells;**
var mFormObj=pDocObj.getElementById(pFormName);
alert("in MoveGridToForm : Form :"+pFormName+" TableRowID :"+pTableRowId+
' mTableName =>:'+mTableName+' =>RowId='+mRowId+' RowObj-->Height'+mRowObj.rowIndex);

var colnames="-1";
var rowdata="-1";
var currid="";
var currval="";
var mFormCtrlName="";
var CtrlsFound=0;
for (i=0;i<mCellsofRow.length;i++)
{  **alert(' i= '+i+' Id '+mCellsofRow[i].firstChild.Type+' value '+mCellsofRow[i].firstChild.innerHTML);
currid= (mCellsofRow[i].item[0].id==null) ? "XX" :mCellsofRow[i].item[0].id;
currval=(mCellsofRow(i).item(0).value==null) ? "XX" : mCellsofRow(i).item(0).value;**


FormCtrlForCol=GetFormCtrl(mFormObj,currid);
if ( (currid=="XX" || !(FormCtrlForCol) || FormCtrlForCol==null) && i>0 ) 
{alert("MoveGridToForm--> cell no: "+i+" is Null or no equivalant Control in form present: currid"+currid+" currval:"+currval); continue;}
SetMsg('MoveGridToForm Grid Column id='+currid+ ' Currval= '+currval);
if (FormCtrlForCol)
{ //alert("Type :"+FormCtrlForCol.type);  

问题区域是

alert(' i= '+i+' Id '+mCellsofRow[i].firstChild.Type+' value '+mCellsofRow[i].firstChild.innerHTML);
currid= (mCellsofRow[i].item[0].id==null) ? "XX" :mCellsofRow[i].item[0].id;
currval=(mCellsofRow(i).item(0).value==null) ? "XX" : mCellsofRow(i).item(0).value;*

最新更新