[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
referencing from
Hello,all,
>From NS javascript tutorial :
Example n°4
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
function compute(form)
{
if (confirm("Are you sure?"))
form.result.value = eval(form.expr.value)
else alert("Please come back again.") }
</SCRIPT>
</HEAD>
<BODY>
<FORM>
Enter an expression:
<INPUT TYPE="text" NAME="expr" SIZE=15 >
<INPUT TYPE="button" VALUE="Calculate" ONCLICK="compute(this.form)"> <BR>
Result:
<INPUT TYPE="text" NAME="result" SIZE=15 > <BR>
</FORM>
</BODY>
</HTML>
When you send the value on a form to a function from INSIDE the form you use:
Eventhandler="CalledFunction(this.form)"
How is this done when the sended form is another form that is NOT this.form
in this example, instead of
<FORM>
Enter an expression: <INPUT TYPE="text" NAME="expr" SIZE=15 >
<INPUT TYPE="button" VALUE="Calculate" ONCLICK="compute(this.form)"> <BR>
Result: <INPUT TYPE="text" NAME="result" SIZE=15 > <BR>
</FORM>
if we had :
first form
<FORM>
Enter an expression: <INPUT TYPE="text" NAME="expr" SIZE=15 >
</form>
..
second form
<form>
<INPUT TYPE="button" VALUE="Calculate" ONCLICK="compute(how.is.the.form.sent)">
</form> ^^^^^^^^^^^^^^^^^^^^^^
..
third form
<form>
Result: <INPUT TYPE="text" NAME="result" SIZE=15 > <BR>
</FORM>
the goal is to say to the second form :
^^^^^^^^^^^^
'hey ! when the user whose name is in the first form click on this button, send the
^^^^^^^^^^^ ^^^^^^^^^^^^
result to the third form (the third form beeing in the same window or in a
^^^^^^^^^^
javascript-created other window).