LiveZilla Live Help
 


Go Back   Chime Host - Web Hosting Forum > World Wide Web > Programming / Scripting / Coding Forum > Javascript
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Javascript Need help with the (primarily) client-side programming language? This is the place. Includes discussion on AJAX (Asynchronous JavaScript and XML).

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-20-2009, 06:10 PM
Junior Member
 
Join Date: Aug 2003
Dylan is on a distinguished road
Default HTML and JavaScript calculator help?

i can make this calculator add but not multiply this is what i got so far
<HTML>
<HEAD>
<TITLE>Simple Adder</TITLE>
<SCRIPT LANGUAGE="JavaScript">
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 = "";
}
function calculatex (Ctext, Dtext, form)
{
var C = parseFloat(Ctext);
var D = parseFloat(Dtext);
form.Answer.value = C * D;
}
function ClearForm(form)
{
form.input_C.value = "";
form.input_D.value = "";
form.Answer.value = "";
}

</SCRIPT>
</HEAD>

<BODY>

<P><FONT SIZE="+2">Simple Adder</FONT></P>

<FORM NAME="Calculator" METHOD="post">
<P>Enter a number: <INPUT TYPE=TEXT NAME="input_A""input_C"SIZE=10></P>
<P>Enter a number: <INPUT TYPE=TEXT NAME="input_B""input_D"SIZE=10></P>
<P><INPUT TYPE="button" VALUE="Add Numbers" name="AddButton" onClick="CalculateSum(this.form.input_A.value, this.form.input_B.value, this.form)"></P>
<p><INPUT TYPE="button" VALUE="multiply numbers" name="AddButton"onClick="calculatex(this.form.inpu t_C.value, this.form.input_D value, this.form)"></P>
<P>Answer = <INPUT TYPE=TEXT NAME="Answer" SIZE=12></P>
</FORM>

</BODY>
</HTML>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT +1. The time now is 04:57 PM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Copyright ChimeHost, a Profuse Solutions LLC company