Artenis Posted August 28, 2008 Report Share Posted August 28, 2008 <script> function addElement() { var ni = document.getElementById('myDiv'); var numi = document.getElementById('theValue'); var num = (document.getElementById('theValue').value -1)+ 2; numi.value = num; var newdiv = document.createElement('div'); var divIdName = 'my'+num+'Div'; newdiv.setAttribute('id',divIdName); newdiv.innerHTML = '<tr><td align=\'center\' >'+num+'.</td><td colspan=\'3\' ><p style=\'margin-left:6px;\'><input type=\'text\' style=\'width:190px\' name=\'nosaukums['+num+']\' value=\'\'></p></td><td colspan=\'3\' align=\'center\'><input type=\'hidden\' name=\'neredz['+num+']\' value=\''+num+'\'> <input type=\'text\' style=\'width:80px\' name=\'mervieniba['+num+']\' value=\'\'></td> <td align=\'center\'><input type=\'text\'style=\'width:15px;font-size:11px;\' name=\'daudzums['+num+']\' value=\' \'></td><td colspan=\'2\' align=\'center\' ><input type=\'text\'style=\'width:25px;font-size:11px;\' name=\'cena['+num+']\' value=\'\'> Ls</td><td align=\'center\' > Ls</td> </tr>'; ni.appendChild(newdiv); } function removeElement(divNum) { var d = document.getElementById('myDiv'); var olddiv = document.getElementById(divNum); d.removeChild(olddiv); } </SCRIPT> Palaižot funkciju viņš izbeido visu neskaitot: <tr><td> tagus... Kadēļ tā? Kā to labot?! Link to comment Share on other sites More sharing options...
indoom Posted August 28, 2008 Report Share Posted August 28, 2008 Kur tad <table> tags? Link to comment Share on other sites More sharing options...
Artenis Posted August 28, 2008 Author Report Share Posted August 28, 2008 (edited) tie <tr><td>.... tiek veidoti iekš <table> taga .... <table> <tr><td> Uzgenerejas 1 </td></tr> <tr><td> Uzgenerejas 2 </td></tr> <div id....> //Šeit vajadzēu ģenerēt to, kas ir javascriptā... </div> </table> Bet ģēnerē visu bez <tr><td>... Edited August 28, 2008 by Artenis Link to comment Share on other sites More sharing options...
bubu Posted August 28, 2008 Report Share Posted August 28, 2008 Cik man zināms - iekš table taga kā tiešais child DIV tags nav atļauts. Kamdēļ tev tur vajag div tagu? Lai tabulas beigās ģenerētu? Nevajag tad nekādu DIV tur likt. Vienkārši atrodi konkrētajai tabulai tbody elementu (getElementsByTagName) un šim raksti tbody_elem.appendChild(tr_tags). Link to comment Share on other sites More sharing options...
Artenis Posted August 28, 2008 Author Report Share Posted August 28, 2008 (edited) lēnāk lūdzu un konkrētāk, ja varētu... Nepāŗzinu js tik labi, lai tā uztvertu kā tu to domāji! :) Iepriekš paldies. P.S. Kaut ko pajaucos un kaut kas sāk sanākt, vismaz tagus taisa, kad nav tā div! :) Edited August 28, 2008 by Artenis Link to comment Share on other sites More sharing options...
mefisto Posted August 28, 2008 Report Share Posted August 28, 2008 Ku tu tur mēģini panākt ? Link to comment Share on other sites More sharing options...
Artenis Posted August 28, 2008 Author Report Share Posted August 28, 2008 Visu ko vajadzēja to panācu! :) Paldies bubu par info! Link to comment Share on other sites More sharing options...
Recommended Posts