Philipp Hasenfratz: Functions

Beitrag lesen

Halihallo

ich habe das Problem, dass ich auf einer Seite zwei Formulare habe und zwei Functions xy() miteinbinden möchte, allerdings klappt nur die erste Function und es ist sonst auch kein Fehler zu finden.

Nun meine Frage:
Wie bindet man in der Regel zwei gleiche Functions mit unterschiedlichem Namen ein?

Indem man sie mit einem ';' trennt.

<SCRIPT type...>
xy()
xy2()
</SCRIPT>

<script>
   function xy () {
      var field = document.forms["world"].elements["hello"];
      // was willst denn hier tun?
   }
   function xy2 () {
      // die zweite
   }
   xy();
   xy2();
</script>

<form name="world">
   <input type="text" name="hello" />
</form>

Viele Grüsse

Philipp