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.

Java Script: neues Attribut im Objekt

Empfohlene Antworten

Veröffentlicht

Hallo,

ich habe folgendes Problem, mit dieser Funktion wird die Zielseite (welche in action steht) durch eine neue ersetzt. Ich müsse zudem noch ein paar neue variablen/ attribute anhängen an das Objekt "oForm".

Wie funktioniet das?

function linkSubmit( oForm, sNewFormAction, sNewSite)

{

if (sNewFormAction)

{

oForm.action = sNewFormAction;

}

oForm.submit();

}

Gruss

banane-banane

Wenn es GET-Parameter sein sollen, einfach im if-Teil am Anfang noch

sNewFormAction += "?param1=wert1&param2=wert2&usw..."

reinsetzen oder den richtigen String gleich mit übergeben.

Wenn es POST-Parameter sein sollen, dann mußt du in deinem Form <input type="hidden">-Felder definieren, deren Wert du mit Javascript füllen kannst.

Ich arbeite aber leider noch mit Sessions und somit wird irgenwie der Wert einfach abgeschnitten.

Ich müsste ein attribut so anlegen können das ich z.B. es so dann füllen kann:

oForm.param1.value = wert1

Gruss

banane-banane

Meine 2. Lösung schlug vor, daß du in das Form eine gewisse Anzahl von Input-Feldern mit leerem Wert anlegst:

<form action="somewhat.cgi" method="post" name="myform">

...

<input type="hidden" name="param1" value="" />

<input type="hidden" name="param2" value="" />

...

</form>


.. 

<!-- Beim Absenden oder so dann folgender JavaScript-Code: -->


function linkSubmit( oForm, sNewFormAction, sNewSite)

{

  if (sNewFormAction)

  {

    myform.param1.value = wert1;

    myform.param2.value = wert2;

    ...

    oForm.action = sNewFormAction;

  }


  oForm.submit();

}

Alles klar, danke.

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.