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.

Variable ergänzen

Empfohlene Antworten

Veröffentlicht

Hallo.

Hab leider keine ahnung von javascript und brauch hilfe.

ich möchte den wert einer variable ergänzen

so sieht meine funktion aus:


function enter_relation(relation) {

   var ausgabe = relation;

   document.relation_form.pre_quest.value = ausgabe ;

}

wenn ich nun an die funktion den wert "hallo" übergebe und im nächsten schritt den wert "das ist ein test" sende,

möchte ich als ausgabe folgendes habe: "hallo das ist ein test".

in php ist das was ich suche: .=

aber wie ist das mit javascript?

danke schon mal fürs antworten.


function enter_relation(relation) {

   var ausgabe = relation;

   document.relation_form.pre_quest.value += ausgabe ;

}

oder

function enter_relation(relation) {

   var ausgabe = relation;

   document.relation_form.pre_quest.value = document.relation_form.pre_quest.value + ausgabe ;

}

danke. genau das was ich wollte...

tja, da bin ich wieder...

eine sache erledigt und schon kommen 2 neue hinzu! :(

wie kann ich denn den wert den ich eingetragen hab wieder entfernen...

zb: ich habe meiner variable die werte "hallo" "das" "ist" "ein" "dada" "test"

so und nun möchte ich "dada" wieder raus haben...

also ich muss die variable nach "dada" durchsuchen und durch "" ersetzen!!!

jemand ne idee?

thx


function delete_relation(relation) {

   document.relation_form.pre_quest.value = document.relation_form.pre_quest.value.replace( "/" + relation + "/", "");

}

Gruß,

Markus

Dankeschön. :uli

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.