236539-1-ref.html (2645B)
1 <html> 2 <head> 3 <script type="text/javascript"> 4 var NumLine = 0 5 6 function maj(IDLine) 7 { 8 9 var newtr = document.createElement("tr") 10 newtr.setAttribute("id","tr"+IDLine) 11 12 13 var newtdselect = document.createElement("td") 14 var newselect = document.createElement("select") 15 newselect.setAttribute("id","HypothRank_"+IDLine) 16 newselect.setAttribute("name","HypothRank_"+IDLine) 17 18 for (i=1;i<=IDLine;i++) 19 { 20 21 var newoption = document.createElement("option") 22 newoption.setAttribute("id",i) 23 newoption.setAttribute("class","classoption1") 24 if (i == IDLine) 25 { 26 newoption.setAttribute("selected","selected") 27 } 28 var newtxt = document.createTextNode(i) 29 newoption.appendChild(newtxt) 30 31 newselect.appendChild(newoption) 32 } 33 34 if (i>2) 35 { 36 for (j=1;j<=i-2;j++) 37 { 38 var newoption = document.createElement("option") 39 newoption.setAttribute("class","classoption1") 40 newoption.setAttribute("id",IDLine) 41 var newtxt = document.createTextNode(i-1) 42 newoption.appendChild(newtxt) 43 document.getElementById("HypothRank_"+j).appendChild(newoption) 44 } 45 } 46 47 newtdselect.appendChild(newselect) 48 newtr.appendChild(newtdselect) 49 50 document.getElementById('letbody').appendChild(newtr) 51 52 NumLine++ 53 } 54 55 56 57 function DeleteLine(IDLine) 58 { 59 for (i=1;i<=NumLine;i++) 60 61 { 62 if (i != IDLine) 63 { 64 noeud = document.getElementById("HypothRank_"+i)[IDLine-1] 65 document.getElementById("HypothRank_"+i).removeChild(noeud) 66 for (j=0;j<=NumLine-2;j++) 67 { 68 noeud = document.getElementById("HypothRank_"+i)[j] 69 70 k=j+1 71 noeud.setAttribute("id",k) 72 73 if (k == NumLine) 74 { 75 noeud.setAttribute("selected","selected") 76 } 77 depart = 0 78 taille = noeud.firstChild.nodeValue.length 79 document.getElementById("HypothRank_"+i)[j].firstChild.replaceData(depart,taille,j+1) 80 } 81 } 82 } 83 84 85 noeud = document.getElementById('tr'+IDLine) 86 document.getElementById('letbody').removeChild(noeud) 87 88 NumLine-- 89 90 for (i=IDLine;i<=NumLine;i++) 91 { 92 k=i+1 93 noeud = document.getElementById("tr"+k) 94 noeud.setAttribute("id","tr"+i) 95 96 noeud = document.getElementById("HypothRank_"+k) 97 noeud.setAttribute("id","HypothRank_"+i) 98 noeud.setAttribute("name","HypothRank_"+i) 99 100 noeud = document.getElementById("Hypoth_"+k) 101 noeud.setAttribute("name","Hypoth_"+i) 102 noeud.setAttribute("id","Hypoth_"+i) 103 } 104 105 106 } 107 108 </script> 109 </head> 110 111 <body> 112 <form> 113 <table border="1" id="latable"> 114 <thead></thead> 115 <tfoot></tfoot> 116 <tbody id="letbody"></tbody> 117 </table> 118 </form> 119 120 <script> 121 document.body.offsetWidth; 122 maj(NumLine+1); 123 document.body.offsetWidth; 124 maj(NumLine+1); 125 document.body.offsetWidth; 126 </script> 127 128 </body> 129 </html>