1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
<!DOCTYPE HTML> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> </head> <body> <form> <br /><br /> <table border="1"> <tr><th>Menge</th><th>Bezeichnung</th><th>Euro/Stück</th></tr> <tr> <td><input type="number" name="menge" /></td> <td><input type="text" name="bezeichnung" /></td> <td><input type="text" name="euro_stueck" /></td> </tr> </table> <br /><br /> <br /><input type="submit" value="OK"/> </form> </body> </html>
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
<!DOCTYPE HTML> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <script type="text/javascript"> function ad_row() { var nummer = 1; var tabellen_id = "t1"; var trhtml = document.getElementById( tabellen_id ).insertRow( nummer ); var tdhtml1 = document.createElement( "td" ); var tdhtml2 = document.createElement( "td" ); var tdhtml3 = document.createElement( "td" ); tdhtml1.innerHTML = ''; // content tdhtml2.innerHTML = ''; tdhtml3.innerHTML = ''; trhtml.appendChild( tdhtml1 ); trhtml.appendChild( tdhtml2 ); trhtml.appendChild( tdhtml3 ); } </script> </head> <body> <form> <br /><br /> <table id="t1" border="1"> <tr><th>Menge</th><th>Bezeichnung</th><th>Euro/Stück</th></tr> <tr> <td><input type="number" name="menge" /></td> <td><input type="text" name="bezeichnung" /></td> <td><input type="text" name="euro_stueck" /></td> </tr> </table> <br /><br /> <input type="button" value="Eintrag hinzufügen" onclick="ad_row()" /> <br /><br /> <br /><input type="submit" value="OK"/> </form> </body> </html>
2011-08-26T05:35:48 KuerbisWie kann ich erreichen, dass die Zeilenhöhe gleich ist wie bei der ersten Zeile, ohne einen Content einzufügen?
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
<!DOCTYPE HTML> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <script type="text/javascript"> function ad_row() { var table_id = "t1"; var table = document.getElementById( table_id ); var rows = table.getElementsByTagName( "tr" ).length; var tr = table.insertRow( rows ); var td1 = document.createElement( "td" ); var td2 = document.createElement( "td" ); var td3 = document.createElement( "td" ); td1.innerHTML = '<input type="number" name="menge" />'; td2.innerHTML = '<input type="text" name="bezeichnung" />'; td3.innerHTML = '<input type="text" name="euro_stueck" />'; tr.appendChild( td1 ); tr.appendChild( td2 ); tr.appendChild( td3 ); } </script> </head> <body> <form> <br /><br /> <table id="t1" border="1"> <tr><th>Menge</th><th>Bezeichnung</th><th>Euro/Stück</th></tr> <tr> <td><input type="number" name="menge" /></td> <td><input type="text" name="bezeichnung" /></td> <td><input type="text" name="euro_stueck" /></td> </tr> </table> <br /><br /> <input type="button" value="Eintrag hinzufügen" onclick="ad_row()" /> <br /><br /> <br /><input type="submit" value="OK"/> </form> </body> </html>
2011-08-26T07:44:37 KuerbisHabe einen Weg gefunden. Ich weiß aber nicht, ob das Einfügen der INPUT-Elemente als String so üblich ist.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
<!DOCTYPE HTML> <html> <head> <script type="text/javascript"> function displayResult() { var h = document.getElementById("tr_1").style.height; document.write( h ); } </script> </head> <body> <form> <table id="t1" border="1"> <tr id="test"><th>Menge</th><th>Bezeichnung</th></tr> </table> <br /><br /> <input type="button" onclick="displayResult()" /> </form> </body> </html>