Autor Beitrag
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10181
Erhaltene Danke: 1254

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Do 28.01.10 15:07 
Moin!

Ich brauch mal JS-Nachhilfe. :oops:
ausblenden C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
function SwapValue(node1,node2) {
  var tmp;
  tmp = node1.value;
  node1.value = node2.value;
  node2.value = tmp;
  }

function SwapChecked(node1,node2) {
  var tmp;
  tmp = node1.checked;
  node1.checked = node2.checked;
  node2.checked = tmp;
  }
Wie macht man daraus eine Funktion? :nixweiss:

cu
Narses


Moderiert von user profile iconChristian S.: Topic aus JavaScript - Sprachelemente verschoben am Di 25.03.2014 um 19:51

_________________
There are 10 types of people - those who understand binary and those who don´t.


Zuletzt bearbeitet von Narses am Do 28.01.10 15:59, insgesamt 2-mal bearbeitet
Martok
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 3661
Erhaltene Danke: 604

Win 8.1, Win 10 x64
Pascal: Lazarus Snapshot, Delphi 7,2007; PHP, JS: WebStorm
BeitragVerfasst: Do 28.01.10 15:48 
Entweder Call by Reference, was aber nicht wirklich kompatibel ist. Und schon gar nicht gut dokumentiert, da kann ich also grad nix zu sagen.

Oder:
ausblenden C#-Quelltext
1:
2:
3:
4:
5:
function SwapProp(node1,node2,prop) {
  var tmp = node1[prop];
  node1[prop]= node2[prop];
  node2[prop]= tmp;
}

Aufruf:
ausblenden C#-Quelltext
1:
SwapProp(SomeNode, AnotherNode, 'checked');					

_________________
"The phoenix's price isn't inevitable. It's not part of some deep balance built into the universe. It's just the parts of the game where you haven't figured out yet how to cheat."
Narses Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10181
Erhaltene Danke: 1254

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Do 28.01.10 16:03 
Moin!

Danke! :think: ich wusste doch, dass eine Scriptsprache dynamische Properties können sollte, aber keine Suchbegriffe waren wohl nicht so gut... *g*

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Martok
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 3661
Erhaltene Danke: 604

Win 8.1, Win 10 x64
Pascal: Lazarus Snapshot, Delphi 7,2007; PHP, JS: WebStorm
BeitragVerfasst: Do 28.01.10 16:44 
user profile iconNarses hat folgendes geschrieben Zum zitierten Posting springen:
ich wusste doch, dass eine Scriptsprache dynamische Properties können sollte, aber keine Suchbegriffe waren wohl nicht so gut... *g*

Tja, nutzen zwar viele Frameworks, aber das in einer Doku zu finden ist quasi unmöglich, wenn man nicht weiß dass das kein Hack, sondern direkt normale Vorgehensweise zum Property zugreifen ist ;)

Suche nach Hash oder Assoziativen Arrays hätte das dann gebracht ;) Die werden nämlich über sowas nachgebildet; ECMAScript selbst kennt sowas ja nicht.

_________________
"The phoenix's price isn't inevitable. It's not part of some deep balance built into the universe. It's just the parts of the game where you haven't figured out yet how to cheat."