[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: referencing from



> 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

This is not very elegant but just go for the throat. A form element 
is a directly accessable object. This is NOT a real world example, 
just the concept.

<FORM NAME=form1>
<INPUT NAME=val1 TYPE=text SIZE=20>
</FORM>

<FORM NAME=form2>
<INPUT NAME=val2 TYPE=text SIZE=20>
</FORM>

<FORM NAME=form3>
<INPUT NAME=answer TYPE=text SIZE=20>
</FORM>

<script>
<!--
function total(){
// assumes form strings will equate to integers
   document.form3.answer.value=parseInt(document.form1.val1.value)+
   parseInt(document.form2.val2.value)
}
// -->
</script>

Obviously you will have to place a call to total() somewhere. A total 
button in form3 with onClick"total()" should do it.

John
--------------------------------------------------------------------
For help about the list, please send a message to 'majordomo@obscure.org'
with the message body 'help'. To unsubscribe, send a message to
'majordomo@obscure.org' with the message body 'unsubscribe javascript'.
List archives and pointer to FAQ: http://www.obscure.org/javascript/