Использование Javascript и jQuery:
$(function() {
var list = $("#list").find("li");
// count the total number of <li>'s
var count = $(list).length;
// loop through each <li> and set value to a decreasing value of count
list.each(function() {
$(this).attr("value", count--);
});
});
Соответствующий HTML:
<ol id="list">
<li>first</li>
<li>second</li>
<li>third</li>
</ol>