ordered sublist

(How) Is it possible to write HTML-code that results in the following
ordered list (without 'hardcoding' the numbers) ?

1. First Item
    1.1. First Subitem of First Item
    1.2. Second Subitem of First Item
    1.3. Third Subitem of First Item
2. Second Item
    2.1. First SubItem of First Item
    2.2. Second Subitem of Second Item

Ann_Van_EykenAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mark2150Commented:
I'd like to know too...

M
0
PiNCommented:
I'm afraid, you can't ;-)
0
mblaseCommented:
You can't in HTML, to be sure. The closest solution would use two nested <OL> sets, and look like this:

<OL>
<LI>First Item
    <OL>
    <LI>First Subitem of First Item
    <LI>Second Subitem of First Item
    <LI>Third Subitem of First Item
    </OL>
<LI>Second Item
    <OL>
    <LI>First SubItem of First Item
    <LI>Second Subitem of Second Item
    </OL>
</OL>

Maybe we could cobble a JavaScript solution? It'd be ugly, but it would work --

<SCRIPT LANGUAGE="JavaScript">
<!--
var mc = 0;    // main counter
var sc = 0;    // sub counter
function mcount() { mc++; document.write(mc+". "); }
function scount() { sc++; document.write(mc+"."+sc+". "); }
//-->
</SCRIPT>

<DL>
<DT><SCRIPT LANGUAGE="JavaScript">mcount()</SCRIPT>First Item
    <DD><SCRIPT LANGUAGE="JavaScript">scount()</SCRIPT>First Subitem of First Item
    <DD><SCRIPT LANGUAGE="JavaScript">scount()</SCRIPT>Second Subitem of First Item
    <DD><SCRIPT LANGUAGE="JavaScript">scount()</SCRIPT>Third Subitem of First Item
<DT><SCRIPT LANGUAGE="JavaScript">mcount()</SCRIPT>Second Item
    <DD><SCRIPT LANGUAGE="JavaScript">scount()</SCRIPT>First SubItem of First Item
    <DD><SCRIPT LANGUAGE="JavaScript">scount()</SCRIPT>Second Subitem of Second Item
</DL>
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

PiNCommented:
Funny idea mblase...pretty close to the request...
Congrats !(didn't think of that way)
0
mblaseCommented:
Actually, that doesn't *quite* do what Ann wanted. Here's the line to modify:

function mcount() { mc++; sc=0; document.write(mc+". "); }

Before it counted 1, 1.1, 1.2, 2, 2.3, 2.4... instead of 2, 2.1, 2.2, as desired. This will correct that.
0
mblaseCommented:
Oh, and if you want to make the code a little cleaner, you should be able to eliminate LANGUAGE="JavaScript" from all the <SCRIPT> tags, since all browsers should default to JavaScript as the scripting language to use.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
HTML

From novice to tech pro — start learning today.