我有下面的代碼。我想值1的值發送發送不同的對象值到不同的功能
n.value1s = new Array();
n.value1sIDs = new Array();
n.value1sNames = new Array();
n.value1sColors = new Array();
n.descriptions = new Array();
到
pg.loadLinkedvalue1s(n);
和VALUE2至pg.loadLinkedvalue2s(N);
Howd我這樣做,在javascript巡航能力不重寫功能齊全
請查看下面
if(n.id == "row"){
n.rs = n.parentElement;
if(n.rs.multiSelect == 0){
n.selected = 1;
this.selectedRows = [ n ];
if(this.lastClicked && this.lastClicked != n){
selectionChanged = 1;
this.lastClicked.selected = 0;
this.lastClicked.style.color = "000099";
this.lastClicked.style.backgroundColor = "";
}
} else {
n.selected = n.selected ? 0 : 1;
this.getSelectedRows();
}
this.lastClicked = n;
n.value1s = new Array();
n.value1sIDs = new Array();
n.value1sNames = new Array();
n.value1sColors = new Array();
n.descriptions = new Array();
n.value2s = new Array();
n.value2IDs = new Array();
n.value2Names = new Array();
n.value2Colors = new Array();
n.value2SortOrders = new Array();
n.value2Descriptions = new Array();
var value1s = myOfficeFunction.DOMArray(n.all.value1s.all.value1);
var value2s = myOfficeFunction.DOMArray(n.all.value1s.all.value2);
for(var i=0,j=0,k=1;i<vaue1s.length;i++){
n.sortOrders[j] = k++;
n.vaue1s[j] = vaue1s[i].v;
n.vaue1IDs[j] = vaue1s[i].i;
n.vaue1Colors[j] = vaue1s[i].c;
alert(n.vaue1Colors[j]);
var vals = vaue1s[i].innerText.split(String.fromCharCode(127));
n.cptSortOrders[j] = k++;
n.value2s[j] = value2s[i].v;
n.value2IDs[j] = value2s[i].i;
n.value2Colors[j] = value2s[i].c;
var value2Vals = value2s[i].innerText.split(String.fromCharCode(127));
if(vals.length == 2){
alert(n.vaue1Colors[j]);
n.vaue1Names[j] = vals[0];
n.descriptions[j++] = vals[1];
}
if(value2Vals.length == 2){
n.value2Names[j] = cptVals[0];
alert(n.value2Names[j]);
n.cptDescriptions[j++] = cptVals[1];
alert(n.cptDescriptions[j++]);
}
}
//want to run this with value1 only
pg.loadLinkedvalue1s(n);
// want to run this with value2 only
pg.loadLinkedvalue2s(n);
}
你不必寫'n.value1s =新的Array();'(等人),' n.value1s = [];'是方法更短。 – 2010-05-27 21:27:50