Help - Search - Members - Calendar
Full Version: descending list numbering
HTMLHelp Forums > Web Authoring > General Web Design
Blattella
I'd like to number a list of publications on our webpage in descending order (without numbering each entry), rather than the default ascending order. Is there a simple way to do that (preferably without getting into javascript...since I'm a complete novice). Here is a link to the webpage in question:
Schal lab publications

Thanks.
Brian Chandler
QUOTE(Blattella @ Nov 10 2006, 10:41 PM) *

I'd like to number a list of publications on our webpage in descending order (without numbering each entry), rather than the default ascending order. Is there a simple way to do that (preferably without getting into javascript...since I'm a complete novice). Here is a link to the webpage in question:
Schal lab publications

Thanks.


Nothing to do with HTML I'm afraid. If the list is generated manually, you just need to sort it (manually), and update the web page. If it's generated from a database, you need to change the script that accesses the database to put in an instruction to access entries in descending order of [??uh, what, actually??].

If you want to change the numbering of the list to a set of bullets, the simplest way is to change the <ol> </ol> tags to <ul> </ul>. But this will not affect the ordering.

stjepan
QUOTE
I'd like to number a list of publications on our webpage in descending order (without numbering each entry)


As Brian said: Descending order of author's name, year, title...?
Christian J
Maybe the OP want the numbering reversed, i.e.

3. foo
2. bar
1. baz

AFAIK that can not be done with an <ol> (ordered list) element.
Deepa
QUOTE(Christian J @ Nov 12 2006, 07:14 PM) *

Maybe the OP want the numbering reversed, i.e.

3. foo
2. bar
1. baz

AFAIK that can not be done with an <ol> (ordered list) element.


Yes this is something i am exactly looking for..
Can anyone help please


3. foo -- Title of the Last /Latest post
2. bar
1. baz ---Title of the first post

I want this to give numbers to my posts at my blog
Any help is great help
Thank you
Deepa
pandy
As already said, impossible with HTML. I'm not totally sure, but I don't think CSS can do it either. If it can, browser support is lacking anyway (it's generally poor for counters). Soooo, you'd have to mod the blog software so it outputs the numbers. Me, I'd just forget it but I'm no programmer. Maybe it's easier than I think. tongue.gif
Christian J
Don't know what's possible to do with the existing blog server-side script, but in the meantime here are two javascripts!

This one reverses only the numbering of the content:
CODE
<ol id="reverse_numbering">
<li>foo</li>
<li>bar</li>
<li>baz</li>
</ol>
<script type="text/javascript">
var reverse=document.getElementById('reverse_numbering');
reverse.style.listStyle='none';
var li=reverse.getElementsByTagName('li');
for(var i=0; i<li.length; i++)
{
    li[i].insertBefore(document.createTextNode(li.length-i+'. '), li[i].firstChild);
}
</script>


This one reverses both the content's order and numbering:
CODE
<ol id="reverse_all">
<li>foo</li>
<li>bar</li>
<li>baz</li>
</ol>
<script type="text/javascript">
var reverse=document.getElementById('reverse_all');
reverse.style.listStyle='none';
var li=reverse.getElementsByTagName('li');
for(var i=0; i<li.length; i++)
{
    li[i].insertBefore(document.createTextNode(i+1+'. '), li[i].firstChild);
    reverse.insertBefore(li[i], reverse.firstChild);
}
</script>


Note that if a browser doesn't support javascript the original order will appear.

And if a browser supports javascript but doesn't remove the list-style (unlikely but possible in e.g. Opera with an user style sheet), you'll get something ugly like

1. 3. baz
2. 2. bar
3. 1. foo

To minimize such calamities it might be better to start with an unordered HTML list.
Brian Chandler
QUOTE(Deepa @ Feb 7 2007, 03:43 PM) *

QUOTE(Christian J @ Nov 12 2006, 07:14 PM) *

Maybe the OP want the numbering reversed, i.e.

3. foo
2. bar
1. baz

AFAIK that can not be done with an <ol> (ordered list) element.


Yes this is something i am exactly looking for..
Can anyone help please


3. foo -- Title of the Last /Latest post
2. bar
1. baz ---Title of the first post

I want this to give numbers to my posts at my blog
Any help is great help
Thank you
Deepa


How do you generate the html page of your blog? Surely you do not number things by hand?

The script that produces a page can produce the numbers (the right numbers, all the time) in whatever order. Such things are a matter of programming, which is (as we are told boringly often) not what HTML is for.

Javascripts hacks to try to simulate this sort of thing are unbelievably ugly, non-robust, and unreliable. I would not waste time even thinking about them. Stuff like fancy CSS numbering schemes will remain half-baked until CSS finally departs into the sunset.


alskdjfhg
QUOTE(Blattella @ Nov 10 2006, 08:41 AM) *

I'd like to number a list of publications on our webpage in descending order (without numbering each entry), rather than the default ascending order. Is there a simple way to do that (preferably without getting into javascript...since I'm a complete novice). Here is a link to the webpage in question:
Schal lab publications

Thanks.

would an unordered list work?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.