Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Per Klick auf Button hinzufügen einer Zeile

Empfohlene Antworten

Moin,

ich hab da ein kleines Problem. Ich füge per Klick auf einen Button eine Zeile in eine Tabelle hinzu. Das funktioniert auch prima.

Hier der Code dafür:

var i=0;


function neueZeile()

{

var myTR = document.createElement("tr");

var myTD = document.createElement("td");

var myTD2 = document.createElement("td");

var myTD3 = document.createElement("td");

var myTD4 = document.createElement("td");

var input = document.createElement("input");

input.name = "text";

input.className = "e1";

var input2 = document.createElement("input");

input2.className = "e1";

var input3 = document.createElement("input");

input3.className = "e1";

var input4 = document.createElement("input");

input4.className = "e1";

myTD.appendChild(input);

myTD2.appendChild(input2);

myTD3.appendChild(input3);

myTD4.appendChild(input4);

myTR.appendChild(myTD);

myTR.appendChild(myTD2);

myTR.appendChild(myTD3);

myTR.appendChild(myTD4);

var Ausgabebereich = document.getElementById("nz");

Ausgabebereich.appendChild(myTR);


i++;



}



function loeschenZeile()

{




if (i>0)

{

document.getElementById('t').deleteRow(i);

i--;


}


}
 <table width = "90%" border="1" align = "center" id="t">

  <tr>

  <td width = "30%" align = "center">Artikel-Nr</td>

  <td width = "10%" align = "center">Menge</td>

  <td width = "40%" align = "center">Warenbezeichnung</td>

  <td width = "10%" align = "center">Einzelpreis</td>

  </tr>

  <tbody id="nz"></tbody>

  </table>


<button name="nz" type="button"

onClick="neueZeile()">

Zeile erstellen

</button>


<button name="nz" type="button"

onClick="loeschenZeile()">

Zeile löschen

</button>

Jedoch haben die Eingabefelder der hinzugefügten Zeile eine fixe Größe. Wie kann ich denn nun den Eingabefeldern seperate Größen verpassen?

Greetz

Bearbeitet von flekzz
rechtschreibfehler

Ach ich bin nen Schussel :D

Habs selber rausgefunden :>

Einfach input.size :D

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.