/ Published in: HTML
This is a raw example of the nested lists structure with inherited numeration.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1251"> <script language="javascript"> $(document).ready(function() { var numNestedList = $('ul ul'); var numItems = $('ul > li'); var numNestedItems = $('li ul li'); for (i=0; i<numItems.length; i++) { numItems.not('li ul li').eq(i).prepend(i+1+". "); } for (i=0; i<numNestedItems.length; i++) { for (j=0; j<numNestedList.length; j++) { var nUl = numNestedList.eq(j).parent().text(); numero = nUl.split(".",1); } numNestedItems.eq(i).prepend(numero + "." + (i+1) + ". "); } }); </script> <style media="screen" type="text/css"> ul, ul ul { list-style:none; } </style> </head> <body> <ul> <li>Second Item <ul> </ul> </li> </ul> </body> </html>
URL: http://serhiy.com.ua/examples/lists-numeration/