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-Problem

Empfohlene Antworten

Hallo,

ich hab folgendes Problem:

In einem Formular gibt es 2 Radiobuttons:

o Zeitraum: Combobox

o von: Combobox bis Combobox

(o sind die Radiobuttons)

Es soll jetzt über Javascript so gesteuert werden, dass z.B. der 2 Radiobutton aktiviert wird, wenn man in einer der letzten 2 Comboboxen was ändert.

Momentan hab ichs so gemacht, dass ich bei onChange der Comboboxen die Funktion setChecked aufrufe. Allerdings weiss ich nicht, wie ich jetzt genau sagen kann, welcher Radiobutton aktiviert werden soll, weil ja alle gleich heissen. Das muss irgendwie über den Value gehen, aber ich hab nichts gefunden, wie es genau funktioniert. :confused:

Vielen Dank im voraus

johannes


function setChecked(id)

{

  document.getElementById(id).checked = true;

}


<input type="radio" name="radiobutton" id="radio1">

<select name="select" onChange="setChecked('radio1')">

</select>


<input type="radio" name="radiobutton" id="radio2">

<select name="von" onChange="setChecked('radio2')">

</select>

bis

<select name="bis" onChange="setChecked('radio2')">

</select>


Vielen Dank, hat funktioniert!

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.