Hi,
I have the following code
why do I not have the records array equaling the following data structure...
records[0].summary.col1 = 'val1'
records[0].summary.col2 = 'val2'
records[1].summary.col1 = 'val3'
records[1].summary.col2 = 'val4'
the alert is showing undefined?
Cheers,
1DMF
"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."
"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"
Google Rank Extractor -> Perl beta with FusionCharts
I have the following code
Code:
<html>
<head>
<script>
var records = new Array();
function setPage1Records(tp)
{
html = "col1|val1||col2|val2|||Col1|val3||col2|val4";
var recs = html.split("|||");
for (var i=0; i<recs.length; i++)
{
records[i] = new Object();
records[i][tp] = new Object();
var data = recs[i].split("||");
for (var j=0; j<data.length; j++)
{
var vals = data[j].split("|");
records[i][tp][vals[0]] = vals[1];
}
}
alert(records[1].summary.col1);
}
</script>
</head>
<body>
<input type="button" value="testing JS Object" onclick="setPage1Records('summary');" />
</body>
</html>
why do I not have the records array equaling the following data structure...
records[0].summary.col1 = 'val1'
records[0].summary.col2 = 'val2'
records[1].summary.col1 = 'val3'
records[1].summary.col2 = 'val4'
the alert is showing undefined?
Cheers,
1DMF
"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."
"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"
Google Rank Extractor -> Perl beta with FusionCharts