Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8

Thread: JavaScript Help

  1. #1
    New Coder
    Join Date
    Dec 2010
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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.

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,866
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    Code:
    <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
    Code:
    .atozUl ul{
    width:30%;
    float:left;
    list-style:none;
    }
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    New Coder
    Join Date
    Dec 2010
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi, thanks for the feedback, however I dont want it using CSS i just want it to use JavaScript to seperate the lists.

  • #4
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,318
    Thanks
    203
    Thanked 2,566 Times in 2,544 Posts
    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:-

    Code:
    <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.

  • #5
    New Coder
    Join Date
    Dec 2010
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #6
    New Coder
    Join Date
    Dec 2010
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    could you not include the info in an array and then tell it how to output the data?

  • #7
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,318
    Thanks
    203
    Thanked 2,566 Times in 2,544 Posts
    Quote Originally Posted by swfc4lyf View Post
    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?

  • #8
    New Coder
    Join Date
    Dec 2010
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •