campo1 campo2
campo3 campo4
e così anche negli altri file data.txt.
La pagina html è questa:
codice:<html> <head> <meta http-Equiv="Cache-Control" Content="no-cache"> <meta http-Equiv="Pragma" Content="no-cache"> <meta http-Equiv="Expires" Content="0"> <style type="text/css"> body { font-size: 100%; background: #9a9; } h3 { width: 180px; font: 18px "arial black"; color: #474; margin: 80px auto 0 auto; } #stuff { width: 600px; margin: 10px auto; } #stuff th { font: 11px "arial black"; color: #060; letter-spacing: .4em; border-left: 3px #000 solid; border-right: 1px #000 solid; background: #fff; } #stuff td { font: normal 12px monospace; text-align: center; padding: 3px; border-top: 1px #888 solid; border-right: 1px #000 solid; border-bottom: 1px #888 solid; border-left: 3px #000 solid; background: #d0d8d0; } #buffer { display: none; } </style> <script type="text/javascript"> function caricatesto() { if (!document.getElementById || !document.getElementsByTagName) return; var frm = null,prenode,tbod = document.getElementById('tbod'),data = ''; if ((frm = top.frames['buffer']) //iframe && frm.document) { //get <pre> parent prenode = frm.document.getElementsByTagName('pre').item(0); if (null != prenode && null != prenode.firstChild && /#text/.test(prenode.firstChild.nodeName)) //text node { data += prenode.firstChild.data; //read data = data.split(/[\n\r]/); //separate lines data.splice(0, 0); //lose first one (legend) var i = 0,l = data.length,rowdata,ii, ll, tr, td; for (; i < l; ++i) { tr = document.createElement('tr'); //new row tbod.appendChild(tr); rowdata = data[i].split("\t"); //separate bits for (ii = 0, ll = rowdata.length; ii < ll; ++ii) { var mia = rowdata[1]; td = document.createElement('td'); //new cell var link = document.createElement("a"); link.setAttribute("href", mia); //link.setAttribute("class", "thickbox"); if (ii != 1) { link.appendChild(document.createTextNode(rowdata[ii])); td.appendChild(link); tr.appendChild(td); } } } } } } </script> </head> <body> <select onchange="javascript: window.frames.buffer.location.href =this.options[this.selectedIndex].value;caricatesto();"> <option value="">-------</option> <option value="data1.txt">uno</option> <option value="data2.txt">due</option> <option value="data3.txt">tre</option> </select> </form> <h3>Progetto</h3> <table id="stuff"> <thead> <tr> <th>descrizione</th> </tr> </thead> <tbody id="tbod"> </tbody> </table> <iframe src="" id="buffer" name="buffer" ></iframe> </body> </html>

Rispondi quotando