[thelist] JavaScript Array and Split
Rick den Haan
rick.denhaan at gmail.com
Sun Feb 11 17:40:22 CST 2007
Christie wrote:
> There are various external js files that each have varying cData arrays
that
> look like this
> cData=new Array()
> cData[0]='Auto
> Order|../../courseid12663/AutoOrder/autoordercm.html|772|520|0|00:00:0||'
> cData[1]='Steep Slope Roofing Basics
>
Test|../../courseid12663/SteepSlopeRoofingBasicsTest/mcq_ssbasics_cm.html|77
> 2|520|0|00:00:0||'
> cData[2]='TimeCalc Payroll
>
Database|../../courseid12663/TimeCalcPayrollDatabase/ssrpimctest.html|772|52
> 0|0|00:00:0||'
>
> I found this example which close to what I need to do.
>
> EXCEPT it needs to read the cData array from the external js file to
> generate the list of links.
Christie,
You could wrap the code that reads out/splits the array into a function, and
call that function from the external file.
Example:
main.js:
function doSomething(cData)
{
// split and output cData
}
external1.js:
var cData = new Array();
cData[0] = '' // whatever
doSomething(cData);
HTH,
Rick.
More information about the thelist
mailing list