In the following code I create an array with an object that has 3 properties.
I then dynamically create a table wherein one of the cells I create a button.
The button has several parameters, which it is suppose to send with the onclick event handler. One of the parameters is the array (see line 34 of code).
However when I click on the rendered button, I get this error message that says: "missing ] after element list".
I then dynamically create a table wherein one of the cells I create a button.
The button has several parameters, which it is suppose to send with the onclick event handler. One of the parameters is the array (see line 34 of code).
However when I click on the rendered button, I get this error message that says: "missing ] after element list".
Code:
function mapNlistJobs(cPoint, cJob, cPrjctName, cPrjctAddr, cDept, cTitle, cLat, cLon)
{
var cArray = new Array();
cArray[cArray.length] = {job:cTitle, pName:cPrjctName, pAddr:cPrjctAddr};
var cText = "Job # "+cJob+"<br />"+cPrjctName+"<br />"+cPrjctAddr;
var tr, td;
tbody = document.getElementById("closeJobs");
//add job row
tr = tbody.insertRow(tbody.rows.length);
//make new cell
td = tr.insertCell(tr.cells.length);
//fill in content
td.innerHTML = cJob;
//make new cell
td = tr.insertCell(tr.cells.length);
//fill in content
td.innerHTML = cPrjctName;
//make new cell
td = tr.insertCell(tr.cells.length);
//could not use this option because I am already using ' and " as delimiters
// td.innerHTML = '<input type="button" value="Center" class="InputText" onClick="centerOnThis( '+cLat+', '+cLon+', '+cTitle+', '+cPrjctName+', '+cPrjctAddr+' );"/>'
//here is where I am trying to include the array as a parameter.
td.innerHTML = '<input type="button" value="Center" class="InputText" onClick="centerOnThis( '+cLat+', '+cLon+', '+cArray+' );"/>'
}
Comment