hi JGD,
the example below will take the chunk of csv text, split it into individual lines, then create dat() objects by splitting each line on the comma. hope this gives you some ideas!
[tt]
<html>
<head>
<title>csv to data</title>
<script name="javascript">
var aData = new Array();
function getData(sArgs) {
var aArgs = sArgs.split(/\s/);
for (idx = 0; idx < aArgs.length; idx++) {
aData[idx] = new dat(aArgs[idx]);
}
}
function dat() {
var a = arguments[0].split(',');
for (inx = 0; inx < a.length; inx++) {
this[inx] = a[inx];
}
}
function showData() {
for (idx = 0; idx < aData.length; idx++) {
sMsg = "";
for (el in aData[idx]) {
sMsg += "aData[" + idx +
"][" + el + "] = " +
aData[idx][el] + "\n";
}
alert(sMsg);
}
}
</script>
<style type="text/css">
</style>
<meta name="author" content="?">
<meta name="keywords" content="?">
<meta name="description" content="?">
</head>
<body onload="">
<form name="" action="" method="">
<textarea name="databook" rows="8" cols="35">A1371001,250,0,150,0,0,200,100,0
A1231002,70,0,130,0,200,0,0,350
A1451003,0,150,0,200,150,0,120,0 </textarea>
<p />
<input type="button" name="" value="getData();" onclick="getData(this.form.databook.value);" />
<p />
<input type="button" name="" value="how many dat() objects?" onclick="alert(aData.length);" />
<p />
<input type="button" name="" value="show dat() objects" onclick="showData();" />
</form>
</body>
</html>
[/tt] =========================================================
if (!succeed) try();
-jeff