Below is some code that I used while playing with formulas and
gadgets... hope it helps

function CalculateSum(Atext, Btext, form)
{
var A = parseFloat(Atext);
var B = parseFloat(Btext);
form.Answer.value = A + B;
}
function ClearForm(form)
{
form.input_A.value = "";
form.input_B.value = "";
form.Answer.value = "";
}
<FONT SIZE="+1">Your Add Box</FONT>
<FORM NAME="Calculator" METHOD="post">
<P><INPUT TYPE=TEXT NAME="input_A" SIZE=5> + <INPUT TYPE=TEXT
NAME="input_B" SIZE=5>
<P><INPUT TYPE=TEXT NAME="Answer" SIZE=12></P>
<P><INPUT TYPE="button" VALUE="Calc" name="AddButton"
onClick="CalculateSum(this.form.input_A.value,
this.form.input_B.value, this.form)"> <INPUT TYPE="button"
VALUE="Reset" name="ClearButton" onClick="ClearForm(this.form)"></P>
</FORM>

On Aug 31, 2:18 am, Marion T <[email protected]> wrote:
> Hello -
> I am new to learning about writing gadgets, and could use a push towards a
> tutorial, or assistance with my initial, simple example.  I have looked at
> pre-existing gadgets, and figured out (sort of) how to get my input fields,
> and a compute button to appear, but I don't know how to get the answer.
>
> Profit Needed Calculator (eg, how much profit is needed for Profit *
> (35/100) to equal 15000:
> Input:  MWG (user enters a value, such as 15,000)
> Input:  Rate % (user enters a value, such as 35, for 35%)
>
> Answer: Profit  $42,857.14 based on formula:   mwg / (rate/100)  = 15000/
> (35/100)
>
> Yes, I realize this is simplistic, but it will be a building block for me to
> learn how to create more complex gadgets.
>
> Appreciate your assistance -

-- 
You received this message because you are subscribed to the Google Groups 
"iGoogle Developer Forum" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/Google-Gadgets-API?hl=en.

Reply via email to