<SCRIPT>
function echo(form,
currentField) {
if (currentField == "first")
form.second.value
= form.first.value;
else
form.first.value
= form.second.value;
}
</SCRIPT>
<FORM>
<INPUT
TYPE="text"
NAME="first"
onChange="echo(this.form,
this.name);">
<INPUT
TYPE="text"
NAME="second"
onChange="echo(this.form,
this.name);">
</FORM>
This example illustrates an important point.
echo(this.form,
this.name) passes 2 parameters:
this.form -- because we want to
pass all the form's information to the function
this.name -- to tell the function
what particular form element made the call
|