...

View Full Version : JavaScript Help



swfc4lyf
12-08-2010, 03:10 PM
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.

abduraooft
12-08-2010, 03:16 PM
<ul class="atozUl">
<li>
<ul>
<li>Copyright</li>
<li>Council - spending plans - consultation</li>
<li>Data protection</li>
</ul>
</li>
<li>
<ul>
<li>Digital Region</li>
<li>Freedom of information</li>
<li>Libraries - online information resources</li>
</ul>
</li>
<li>
<ul>
<li>Our Standards</li>
</ul>
</li>
</ul>
CSS

.atozUl ul{
width:30%;
float:left;
list-style:none;
}

swfc4lyf
12-08-2010, 03:19 PM
Hi, thanks for the feedback, however I dont want it using CSS i just want it to use JavaScript to seperate the lists.

Philip M
12-08-2010, 05:04 PM
Could we request that you have a look at the forum rules and guidelines, especially those relating to silly thread titles and use of [ code ] tags.

You cannot use Javascript for this purpose - the correct method is CSS. Javascript cannot control page layout. Using HTML and a table alone you would get this result:-


<table width = "100%">
<ul class="atozUl">
<td>
<li>Copyright</li>
<li>Council - spending plans - consultation</li>
<li>Data protection</li>
</td>
<td>
<li>Digital Region</li>
<li>Freedom of information</li>
</td>
<td>
<li>Libraries - online information resources</li>
<li>Our Standards</li>
</td>
</ul>
</table>

Quizmaster: Which African country gives its name to the complaint known as 'gippy tummy'?
Contestant: Venezuela.

swfc4lyf
12-09-2010, 08:57 AM
give me a break im new to this and only learning what to do and the functionality etc...
if you use CSS which i did orignally it outputs 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

swfc4lyf
12-09-2010, 08:59 AM
could you not include the info in an array and then tell it how to output the data?

Philip M
12-09-2010, 09:07 AM
give me a break im new to this and only learning what to do and the functionality etc...
if you use CSS which i did orignally it outputs 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

Well, why not change the order of the bullet points to match the desired display?

swfc4lyf
12-09-2010, 09:15 AM
yes I can understand your thinking, i know the one I have posted above is only smaller but when I have it fully functionally I am implementing it to a site that has vast 100s of lists and changing them individually would take too long where is if i can get this working i can implement it and it will do the changes for me.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum