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.

JavaScript - <tr> hinzufügen und wieder ausblenden mittels radiobuttons

Empfohlene Antworten

Veröffentlicht

Hi,

vielleicht kann mir jemand helfen.

Ich habe zwei radiobuttons: ja & nein (s. code).

beim klick auf "ja" soll eine zusätzliche <tr> dazu geschrieben werden und beim klick auf nein soll sie wieder verschwinden.

Wie kann ich das am besten umsetzen?

<tr>

   <td width="230" height="30">headline</td>

   <td width="350><input type="radio" name="zahlung" value="ja" checked>[COLOR=Red]ja[/COLOR]

                  <input type="radio" name="zahlung" value="nein">[COLOR=Red]nein[/COLOR]</td>

<tr>

vielen dank im voraus,

marcus

Hi,

vielleicht kann mir jemand helfen.

Ich habe zwei radiobuttons: ja & nein (s. code).

beim klick auf "ja" soll eine zusätzliche <tr> dazu geschrieben werden und beim klick auf nein soll sie wieder verschwinden.

Hier ein Beispiel aus SelfHTML:


<html><head><title>Test</title>

<script type="text/javascript">

<!--

 var Zelle = 0;

 function neueZelle() {

  if (Zelle==0) document.getElementById("Zeile").deleteCell(0);

  var Text = document.createTextNode(document.Formular.Eingabe.value);

  var TD = document.getElementById("Zeile").insertCell(Zelle);

  Zelle += 1;

  TD.appendChild(Text);

  document.Formular.Eingabe.value = "";

 }

//-->

</script>

</head><body>

<table border="1">

<tr id="Zeile"><td>Zelle</td></tr>

</table>

<form name="Formular" action="">

<input type="text" name="Eingabe">

<input type="button" value=" OK " onClick="neueZelle()">

</form>

</body></html>

Damit wird einer Tabellenzeile eine neue Zelle hinzugefügt.

Meine Idee:

Du legst eine leere Zeile an <tr id="neue Zeile"></tr>, Zeilen ohne Zellen werden ja nicht angezeigt, also so gut wie nicht. Über Onclick des RadioButtons fügst du eine oder mehrere Zellen zu dieser Zeile hinzu. Löschen genauso. Falls du mehr als eine Zelle hast kannst du über das Array "cells" des Elements "tr" in JavaScript auf die einzelnen Zellen zugreifen.

hehe, kills ist lustig. dann hättest ja gleich den hier posten können

http://forum.fachinformatiker.de/showthread.php?t=62883

aber ich versteh schon. du wolltest sagen dass hier schon des öfteren danach gefragt und wurde und suchfunktion und so ;) ;)

oh mist ich wollte eingentlich den link zu dem richtigen thread posten ;)

Sorry

oh mist ich wollte eingentlich den link zu dem richtigen thread posten ;)

Sorry

Vielen Dank an alle! :)

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.