1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
body {background:#fff;}
ul {white-space:nowrap;}
table {width:80%;margin:0 auto;}
td {border:1px dotted #666;}
</style>
<script type="text/javascript">
<!--
function TJK_moveNodes(sourceNode,targetNode,newWrapperTagName){// v1.0 Copyright (c) 2006 TJKDesign - Thierry Koblentz
if (!document.createElement) return;
var nodeRecipient=(targetNode)?targetNode:document.createElement(newWrapperTagName);
while(sourceNode.childNodes.length)nodeRecipient.appendChild(sourceNode.childNodes[0]);
if(newWrapperTagName)sourceNode.appendChild(nodeRecipient);
}
function TJK_listINTOcolumns(cols){// v1.0 Copyright (c) 2006 TJKDesign - Thierry Koblentz
if (!document.getElementById || !document.createElement) return;
var z_Doc = document.getElementsByTagName("body")[0];
var z_OL = document.getElementsByTagName("ol")[0];
var z_Caption = document.createElement('caption');
var z_LI = z_OL.getElementsByTagName("li");
var z_Table = document.createElement('table');
var z_Tbody = document.createElement('tbody');
var z_Row;
var z_Cell;
var z_Text;
var number;
var loop = Math.round(eval(z_LI.length/cols)-.5) ; // LIs divided by Columns with rounding stuff
var z;
for (var x=0;x<loop;x++){
z=x;
z_Row = document.createElement('tr');
for (var i=0;i<cols;i++){
z_Cell = document.createElement('td');
number = (z<9) ? "0"+eval(z+1)+"." : eval(z+1)+".";
z_Text = document.createTextNode(number);
z_Cell.appendChild(z_Text);
TJK_moveNodes(z_LI[z],z_Cell,'');
z_Row.appendChild(z_Cell);
if(eval(z+loop)<z_LI.length) z+=loop;
}
z_Tbody.appendChild(z_Row);
}
z_Table.appendChild(z_Tbody);
z_Doc.insertBefore(z_Table,document.getElementsByTagName("p")[0]);
z_Doc.insertBefore(z_Table,z_OL);
z_Doc.removeChild(z_OL);
}
//-->
</script>
</head>
<body onload="TJK_listINTOcolumns(3);">
<h1>Look Ma, no hook, no wrapper, nada!</h1>
<ol>
<li><a href="#">Aloe</a></li>
<li><a href="#">Bergamot</a></li>
<li><a href="#">Calendula</a></li>
<li><a href="#">Damiana</a></li>
<li><a href="#">Elderflower</a></li>
<li><a href="#">Feverfew</a></li>
<li><a href="#">Ginger</a></li>
<li><a href="#">Hops</a></li>
<li><a href="#">Iris</a></li>
<li><a href="#">Juniper</a></li>
<li><a href="#">Kava kava</a></li>
<li><a href="#">Lavender</a></li>
<li><a href="#">Marjoram</a></li>
<li><a href="#">Nutmeg</a></li>
<li><a href="#">Oregano</a></li>
</ol>
<p>Markup below:</p>
<pre><ol><br /><li><a href="#">Aloe</a></li><br /><li><a href="#">Bergamot</a></li><br /><li><a href="#">Calendula</a></li><br /><li><a href="#">Damiana</a></li><br /><li><a href="#">Elderflower</a></li><br /><li><a href="#">Feverfew</a></li><br /><li><a href="#">Ginger</a></li><br /><li><a href="#">Hops</a></li><br /><li><a href="#">Iris</a></li><br /><li><a href="#">Juniper</a></li><br /><li><a href="#">Kava kava</a></li><br /><li><a href="#">Lavender</a></li><br /><li><a href="#">Marjoram</a></li><br /><li><a href="#">Nutmeg</a></li><br /><li><a href="#">Oregano</a></li><br /></ol></pre>
</body>
</html> |
Partager