...

View Full Version : Simple Array



swfc4lyf
12-09-2010, 10:42 AM
Im new to JavaScript so take it steady, i have an array:

<script type="text/javascript">

var colOne [0] = new Array("Copyright", "Council - spending plans - consultation", "Data protection");
var colTwo [1] = new Array("Digital Region", "Freedom of information", "Libraries - online information resources");
var colThree [2] = new Array("Our standards", "Test"};


document.write(colOne[0]);


</script>

anyone can tell why it does not work?

Philip M
12-09-2010, 10:48 AM
"Test"};



var colOne = new Array("Copyright", "Council - spending plans - consultation", "Data protection");
var colTwo = new Array("Digital Region", "Freedom of information", "Libraries - online information resources");
var colThree = new Array("Our standards", "Test");

document.write(colOne[1]);


"How do you get your best midfielders to play together? Capello, unlike his successor, has the answer." - Football commentator

swfc4lyf
12-09-2010, 10:53 AM
got it working


var colOne = new Array("Copyright", "Council - spending plans - consultation", "Data protection");
var colTwo = new Array("Digital Region", "Freedom of information", "Libraries - online information resources");
var colThree = new Array("Our standards", "Test");


document.write(colOne);

swfc4lyf
12-13-2010, 11:48 AM
<script type="text/javascript">

var colOne = new Array("<li>Copyright</li>", "<li>Council - spending plans - consultation</li>", "<li>Data protection</li>");
var colTwo = new Array("<li>Digital Region</li>", "<li>Freedom of information</li>", "<li>Libraries - online information resources</li>");
var colThree = new Array("<li>Our standards</li>", "<li>Test</li>");


//document.write(colOne);
//document.write(colTwo);
//document.write(colThree);
for (i = 0; i < 3; i++)
{ document.write(colOne[i]);
if (i < 3)
document.write("");
}



</script>

got this at the moment....

want it to output the other two arrays at the side of the current one so it looks like they are in 3 columns.

jmrker
12-13-2010, 05:21 PM
If you are happy with your query, close the thread at both places;
See: http://www.webdeveloper.com/forum/showthread.php?t=239569



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum