[thelist] JavaScript Array and Split

Christie Mason cmason at managersforum.com
Sun Feb 11 17:49:43 CST 2007


I can't put anything into the existing external files, or am I
misunderstanding your advice?  I'm thinking I'm lost at how I read the cData
array in external1.js into a second file and then split and output within
that second file.

Christie Mason

-----Original Message-----
From: thelist-bounces at lists.evolt.org
[mailto:thelist-bounces at lists.evolt.org]On Behalf Of Rick den Haan
Sent: Sunday, February 11, 2007 5:40 PM
To: thelist at lists.evolt.org
Subject: Re: [thelist] JavaScript Array and Split


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.

--

* * Please support the community that supports you.  * *
http://evolt.org/help_support_evolt/

For unsubscribe and other options, including the Tip Harvester
and archives of thelist go to: http://lists.evolt.org
Workers of the Web, evolt !




More information about the thelist mailing list