/    Sign up×
Community /Pin to ProfileBookmark

gathering the values in an array

i have a page where i use the function below to add rows to a table…

var gRowId = 1;
var counterRow=0;
var matterIdArray = new Array();
function addRow(){
//alert(gRowId);
//gRowId++;

//if((gRowId !=1)||((gRowId>=2)&&(document.getElementsByTagName(“matterId”).value==null))){
// alert(“Please enter the matterId for the row added and then click on add row”);
//}else{
//counterRow++;
var tbody = document.getElementById(“table1”).getElementsByTagName(“tbody”)[0];
var row = document.createElement(“TR”);
var cell1 = document.createElement(“TD”);
cell1.innerHTML = “MatterID”;
//cell1.innerHTML = gRowId;

var cell2 = document.createElement(“TD”);
var inp1 = document.createElement(“INPUT”);
inp1.setAttribute(“type”,”text”);
inp1.setAttribute(“value”,””);
inp1.setAttribute(“size”,”90″);
inp1.setAttribute(‘id’,’matterId[‘+gRowId+’]’);
cell2.appendChild(inp1);

var cell5 = document.createElement(‘TD’);
var inp4 = document.createElement(‘INPUT’);
inp4.setAttribute(‘type’,’button’);
inp4.setAttribute(‘value’,’Delete’);
inp4.onclick=function(){deleteRow(this);}
cell5.appendChild(inp4);

row.appendChild(cell1);
row.appendChild(cell2);
row.appendChild(cell5);
tbody.appendChild(row);
//alert(row.innerHTML);
gRowId++;

cell1 = null;
cell2 = null;
cell3 = null;
cell4 = null;

row = null;
newRow = null;
tbody = null;

// }
}

Now, I want to store all the values that the user has entered in the text boxes to a javascript array – how do i do this …
thankyou

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@phpnoviceMay 08.2006 — How do you do what? Kindof an open-ended request there (ambiguous).
×

Success!

Help @stpaulmn spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...