send different object value to different funtions

Posted by user295189 on Stack Overflow See other posts from Stack Overflow or by user295189
Published on 2010-05-27T21:16:18Z Indexed on 2010/05/27 21:21 UTC
Read the original article Hit count: 708

I have the code below. I want to send the value of value1 n.value1s = new Array();
n.value1sIDs = new Array();
n.value1sNames = new Array();
n.value1sColors = new Array();
n.descriptions = new Array();
to pg.loadLinkedvalue1s(n);

and for value2 to pg.loadLinkedvalue2s(n);
Howd I do that in javascript without haveing to rewrite the complete function
please see the code below

    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);      


    }  

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about javascript-events