Forum Moderators: open
This isn't a javascript solution, but would it be possible for you to use the correct tag (<ol>) for numbered lists and then use CSS to style it as preformatted text? Something like this:
CSS:
.preformatted {
white-space:pre;
} HTML:
<ol class="preformatted">
<li>First item</li>
<li>Second item</li>
<li>Third item</li>
</ol> You may also need to adjust margins/padding etc on the <ol>.
Alternatively, it's valid html to put <pre> tags inside list-items (<li>), so you could try this instead:
<ol>
<li><pre>Some stuff...</pre></li>
</ol> Sorry if I've misunderstood the problem and these won't work (i.e. because you don't know the contents of the <pre> tag in advance etc)! But even if you do use a scripting solution, you may still want to make use of the <ol> tag for the numbering.
-B
[edited by: DrDoc at 6:23 pm (utc) on Aug. 16, 2004]
[edit reason] tidying up [/edit]