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

Who is Participating?
mblaseConnect With a Mentor Commented:
You can't in HTML, to be sure. The closest solution would use two nested <OL> sets, and look like this:

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

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

var mc = 0;    // main counter
var sc = 0;    // sub counter
function mcount() { mc++; document.write(mc+". "); }
function scount() { sc++; document.write(mc+"."+sc+". "); }

<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
I'd like to know too...

I'm afraid, you can't ;-)
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Funny idea mblase...pretty close to the request...
Congrats !(didn't think of that way)
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.
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.
All Courses

From novice to tech pro — start learning today.