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.

Dropdown value

Empfohlene Antworten

Veröffentlicht

Hi evtl kann mir von euch jemand bei diesem Javascript Problem helfen! :)

ich hab ein Inputtype und ein Dropdown:

<input type="text" value="" id="ausgewaehlt">

<select onchange="ausgewaehlt.value = this.value;">

<option value="1">aaa</option>

<option value="2">bbb</option>

<option value="3">ccc</option>

</select>

Wenn ich nun im Dropdown etwas auswähle, dann wird der wert in das input type geschrieben. Soweit so gut. Ich brauche den Value des dropdowns als INT aber in das Input type würde ich gerne die Strings reinschreiben.

Also nicht die 1,2 oder 3 sondern das aaa,bbb oder ccc .

Der Fehler muss beim this.value liegen denk ich mal ... aber this.name ist käse! ;)

WEiss jemand von euch zufällig wie ich auf die Strings und nicht den Value zugreiffen kann ?

Danke mcmaiers

etwa so?

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

<script type="text/javascript">

function CheckAuswahl () {

  var index = 1;

  index = document.Testform.Auswahl.value - 1;

  document.Testform.ausgewaehlt.value = document.Testform.Auswahl.options[index].text;

}

</script>

</head><body>

<form name="Testform" action="">

<input type="text" value="" id="ausgewaehlt" name="ausgewaehlt">

<select name="Auswahl" size="1" onChange="CheckAuswahl()">

<option value="1">aaa</option>

<option value="2">bbb</option>

<option value="3">ccc</option>

</select>

</form>

</body></html>

Ahh cool danke :)

Achte doch bitte mal darauf, das du im richtigen Forum postest. Alles was auf dem Client, also im Browser abläuft, wie HTML und Javascript gehört ins Webdesign. Serverbasierende Sprachen wie PHP oder ASP in die Webserverprogrammierung.

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.