Re: Problems retrieving data from form fields for non-encrypted host
"Siegfried Heintze" <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.xml |
|---|---|
| Organization | Another Netscape Collabra Server User |
| Message-ID | <[email protected]> |
Martin, Ohh do I feel stupid. Sorry! My presentation went great last night thanks to you. I have another presentation tonight and a third one next month. Siegfried "Martin Honnen" <[email protected]> wrote in message news:[email protected]... > > > Siegfried Heintze wrote: > > > > So now I have these two edit boxes with the default values in them and when > > I click add, it adds correctly. However, if I try to change the numeric > > values in the edit boxes and then click add, it restores the default values > > and computes the same sum again. This is strange! > > Well the code you posted does that intentionally, it has the following lines > > var aa=322.33, bb=298.22; > document.main.a.value=""+aa; document.main.b.value=""+bb; > > and that obviously has fixed values for aa and bb and assigns these > values as the content of the form control each time the add function is > called. > > You probably want to give your function add two parameters e.g. > function add (a, b) { > ... > } > and then in the form button you use > <input type="button" value="add" > onclick="add(this.form.elements.a.value, > this.form.elements.b.value);"> > > -- > > Martin Honnen > http://JavaScript.FAQTs.com/