当前位置: 动力学知识库 > 问答 > 编程问答 >

Javascript - Problem in accessing global variables

问题描述:

I want to share values across the two javascript functions but below in second function I am unable to get the value from the global variable

// Following two are global variables

var grid;

var masterTable;

function GridCreated(sender, args)

{

grid = sender; // setting values

masterTable = sender.get_masterTableView(); // setting values - Here masterTable has values in it

masterTable.selectAllItems(true);

}

function abc()

{

debugger;

var collectionofordernumber = 0;

var selectedrows = mastertable.get_selecteditems(); // HERE I UNABLE TO GET THE VALUES FROM MASTERTABLE

for (var i = 0; i < selectedrows.length; i++)

{

var row = selectedrows[i];

var cell = mastertable.getcellbycolumnuniquename(row, "ordernumber")

collectionofordernumber = collectionofordernumber + "-" + cell.innerhtml;

}

document.getelementbyid("hdf1").value = collectionofordernumber;

alert('I m here');

}

I want to share values across the two javascript functions but below in second function I am unable to get the value from the global variable

网友答案:

You defined the variable masterTable but are accessing it with lowercase mastertable?

分享给朋友:
您可能感兴趣的文章:
随机阅读: