The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> descending list numbering
Blattella
post Nov 10 2006, 08:41 AM
Post #1





Group: Members
Posts: 1
Joined: 10-November 06
Member No.: 801



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.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Brian Chandler
post Nov 11 2006, 03:53 AM
Post #2


Jocular coder
*******

Group: Members
Posts: 1,431
Joined: 31-August 06
Member No.: 43



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.

User is online!PM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
stjepan
post Nov 12 2006, 06:14 AM
Post #3


Advanced Member
****

Group: Members
Posts: 245
Joined: 15-October 06
From: zagreb, croatia
Member No.: 445



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


--------------------
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Nov 12 2006, 08:44 AM
Post #4


¤¤¤¤¤¤¤¤¤
********

Group: WDG Moderators
Posts: 2,370
Joined: 10-August 06
Member No.: 7



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.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Deepa
post Feb 7 2007, 01:43 AM
Post #5





Group: Members
Posts: 1
Joined: 7-February 07
Member No.: 1,803



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
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Feb 7 2007, 04:46 AM
Post #6


Don't like donuts. Don't do MySpace.
********

Group: WDG Moderators
Posts: 7,207
Joined: 9-August 06
Member No.: 6



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


--------------------
“Never go to excess, but let moderation be your guide.”
– Cicero
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Feb 7 2007, 07:36 AM
Post #7


¤¤¤¤¤¤¤¤¤
********

Group: WDG Moderators
Posts: 2,370
Joined: 10-August 06
Member No.: 7



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.

This post has been edited by Christian J: Feb 7 2007, 08:21 AM
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Brian Chandler
post Feb 7 2007, 08:06 AM
Post #8


Jocular coder
*******

Group: Members
Posts: 1,431
Joined: 31-August 06
Member No.: 43



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.


User is online!PM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
alskdjfhg
post Feb 7 2007, 05:00 PM
Post #9





Group: Members
Posts: 4
Joined: 4-January 07
Member No.: 1,454



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?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 21st November 2009 - 02:14 AM