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 feldid und inhalt an string anhängen

Empfohlene Antworten

Veröffentlicht

hallo, ich hab folgendes javascript.

function editCell (cell) {

  if (document.all) {

    cell.innerHTML =

      '<INPUT ' +

      ' ID="editCell"' +

      ' ONCLICK="event.cancelBubble = true;"' + 

      ' ONCHANGE="setCell(this.parentElement, this.value)" ' +

      ' VALUE="' + cell.innerText + '"' +

      ' SIZE="' + cell.innerText.length + '"' +

      '>';

    document.all.editCell.focus();

    document.all.editCell.select();

  }

  else if (document.getElementById) {

    cell.normalize();

    var input = document.createElement('INPUT');

    input.setAttribute('value', cell.firstChild.nodeValue);

    input.setAttribute('size', cell.firstChild.nodeValue.length);

    input.onchange = function (evt) { setCell(this.parentNode, 

this.value); };

    input.onclick = function (evt) { 

      evt.cancelBubble = true;

      if (evt.stopPropagation)

        evt.stopPropagation();

    };

    cell.replaceChild(input, cell.firstChild);

    input.focus();

    input.select();

  }


}

function setCell (cell, value) {

  if (document.all)

    cell.innerText = value;

  else if (document.getElementById)

    cell.replaceChild(document.createTextNode(value), cell.firstChild);


  NewWindow('edit.pl','mypopup','300','200','center','front');

}

das hab ich mir aus dem internet geholt...es wird aufgerufen mit

....<td onclick="editCell">inhalt</td> dann hat man wenn man draufklickt ein input feld, dass wieder verschwindet wenn man was in diesem feld geändert hat. nun zu meinem problem:

ich hab in der funktion "setCell" unten noch ne zeile drangehangen, dass mit dem "NewWindow...". Diese Funktion öffnet ein Popup und führt etwas aus und schließt sich sofort wieder(nur wenn in der Zelle etwas geändert wurde).

jetz will ich der adresse momentan nur 'edit.pl' noch get-werte anhängen, d.h. die addresse soll dann ca. so aussehen

'edit.pl?id=&beg='

nun soll hinter id die id stehen die das <td> hat und hinter beg der wert der nun in die zelle geschrieben wird. wie mach ich das?

hallo, die im obigen eintrag betroffene zeile sieht jetzt folgendermaßen aus:

NewWindow('edit.pl?id='+cell+'&beg='+value,'mypopup','300','200','center','front');[code]

der value ist richtig...nur "cell" wenn man cell in edit.pl ausgibt wird ausgegeben: [object HTMLTableCellElemt]

wie bekomm ich die id??

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.