JavaScript Help

Hi I have some simple html that I would like to sort using JavaScript. I’m new to this so I apologise in advance for my inexperience.

<html>
<head>
A-Z List
</head>

<body>

<script type=“text/javascript”>
</script>

<ul class=“atozUl”>
<li>Copyright</li>
<li>Council - spending plans - consultation</li>
<li>Data protection</li>
<li>Digital Region</li>
<li>Freedom of information</li>
<li>Libraries - online information resources</li>
<li>Our Standards</li>
</ul>

</body>

</html>

I would like it output so that the first 3 bullet points in the list output on the left of the page, second three in the middle and the final two on the right hand side using JavaScript.

It sounds like you’re trying to lay out your page using JavaScript. Please research CSS, that’s what it’s for.

yes i need it working in JavaScript, got working in CSS already and it out puts it like.

1.bullet point 1 2. bullet point 2 3.bullet point 3
4.bullet point 4 5. bullet point 5 6.bullet point 6
7.bullet point 7 8. bullet point 8

however I want it to out put it

1.bullet point 1 4.bullet point 4 7.bullet point 7
2.bullet point 2 5.bullet point 5 8.bullet point 8
3.bullet point 3 6.bullet point 6

Create 3 columns and put your elements in there. No JavaScript necessary. Until most browsers implement text columns natively, this is your best bet. Besides, if JavaScript is disabled, most people will see the layout as you have it right now with CSS.

There are quite a few JavaScript solutions for columns, such as this one and [URL=“http://welcome.totheinter.net/columnizer-jquery-plugin/”]this one. You’ll find plenty more if you google columns with JavaScript.

any of you got any code? im a beginner and not too confident

Have a look at the code on the pages I posted. They give some instructions for usage, so try it out and then post back when you hit a snag.

hi, tried it out but can’t seam to get it to work

OK, that’s understandable. Now, the best way to make use of a forum is to post your attempts—preferably as a live link—and then people can suggest what to try next. That way people get to help out and you learn in the process. Otherwise you are asking for someone to do the whole lot for you, which people really should be paid for.

So, preferably post a link of what you have done so far, or at least the code you have tried (preferably as a full page with CSS in the head).

What I have so far:

<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>

I want it to output the other two arrays at the side of the current so that it looks as though it is 3 columns