Click to See Complete Forum and Search --> : Numbered List


dev00
07-23-2003, 10:52 PM
Hello,

I am trying to place an ordered list of numbers in front of list of links. The link list created is dynamic, there can be any number of links, on any given page. What I am trying to figure out is how to write the the appropriate number in front of the appropriate content list. So the first link should have the number one written in front of it. The second link should have the number 2 in front of it, and so on. As you can see, I am unable to use a straight <OL> list due to the graphic bullet that is placed in front of the number. Anybody have any ideas?


The ultimate layout should look something like this:

<table>
<tr>
<td><img src="" width="15" height="15" alt="" border="0"></td>
<td>1. <a href="">Some Content Link</a></td>
</tr>
<tr>
<td><img src="" width="15" height="15" alt="" border="0"></td>
<td>2. <a href="">Some Content Link</a></td>
</tr>
<tr>
<td><img src="" width="15" height="15" alt="" border="0"></td>
<td>3. <a href="">Some Content Link</a></td>
</tr>
</table>

Thanks! Appreciate your help!
Bob

Gollum
07-24-2003, 02:23 AM
What is generating your list of links?
Whatever it is, could keep a record of how many it has produced and insert the appropriate number just before.

dev00
07-24-2003, 08:59 AM
Hey Gollum,

I am unable to handle it that way, unfortunately. I need to handle it client side. But let's say if the list of links being sent to me contains 3, then can I maybe create an array and then document.write (for example "i") before each link? I'm not sure how to tackle this though, as far as the appropriate code.

Then if the list contains 4, would this work too?

Thanks!
/bob

dev00
07-24-2003, 04:23 PM
This was much easier than I thought. I originally made it out to be more difficult than it really is....here is the code I used:

In the header:

<script>
var i=1;
</script>

Then within the table:

<script>document.write(i++ + ".");</script>

Thanks!