Click here to Skip to main content
15,881,852 members
Home / Discussions / Web Development
   

Web Development

 
QuestionGet Page Markup Pin
ASPnoob8-Oct-14 14:14
ASPnoob8-Oct-14 14:14 
AnswerRe: Get Page Markup Pin
Graham Breach8-Oct-14 22:25
Graham Breach8-Oct-14 22:25 
QuestionIssue while using MSSOAPINIT method of SOAP Object in .ASP Pin
DibenduC7-Oct-14 23:39
DibenduC7-Oct-14 23:39 
QuestionSending mail from a webpage using servlet Pin
Meghamaalaa7-Oct-14 1:51
Meghamaalaa7-Oct-14 1:51 
QuestionWierd issue with responsive layout - CSS Pin
Member 111144085-Oct-14 8:50
Member 111144085-Oct-14 8:50 
AnswerRe: Wierd issue with responsive layout - CSS Pin
Member 111144085-Oct-14 11:56
Member 111144085-Oct-14 11:56 
QuestionHow can i Post Radio Button List with Dynamic names to controller Pin
Mujtaba 103885433-Oct-14 20:24
professionalMujtaba 103885433-Oct-14 20:24 
Questionhelp w/js Pin
Charlie Kirk26-Sep-14 15:08
Charlie Kirk26-Sep-14 15:08 
help understanding js code

My project is to insert into a database table, records of calculator entries (entry1, operator,
entry2 and the result). I can't sort it out. As I don't understand the js. Is'Accumulate' the
end result (total), I think 'Op' is the (operator) used (am I showing my
ignorance yet/still)? I think curReadOut & ReadOut are the 2 arguments?

HTML
 <FORM name="Keypad" action="">
<TABLE border=2 width=50 height=60 cellpadding=1 cellspacing=5>
<input name="ReadOut" type="Text" size=24 value="0" width=100%>
<input name="btnClear" type="Button" value="  C  " onclick="Clear()">
<input name="btnClearEntry" type="Button" value="  CE " onclick="ClearEntry()">
<input name="btnSeven" type="Button" value="  7  " onclick="NumPressed(7)">
<input name="btnEight" type="Button" value="  8  " onclick="NumPressed(8)">
<input name="btnNine" type="Button" value="  9  " onclick="NumPressed(9)">
<input name="btnNeg" type="Button" value=" +/- " onclick="Neg()">
<input name="btnPercent" type="Button" value="  % " onclick="Percent()">
<input name="btnFour" type="Button" value="  4  " onclick="NumPressed(4)">
<input name="btnFive" type="Button" value="  5  " onclick="NumPressed(5)">
<input name="btnSix" type="Button" value="  6  " onclick="NumPressed(6)">
<input name="btnPlus" type="Button" value="  +  " onclick="Operation('+')">
<input name="btnMinus" type="Button" value="   -   " onclick="Operation('-')">
<input name="btnOne" type="Button" value="  1  " onclick="NumPressed(1)">
<input name="btnTwo" type="Button" value="  2  " onclick="NumPressed(2)">
<input name="btnThree" type="Button" value="  3  " onclick="NumPressed(3)">
<input name="btnMultiply" type="Button" value="  *  " onclick="Operation('*')">
<input name="btnDivide" type="Button" value="   /   " onclick="Operation('/')">
<input name="btnZero" type="Button" value="  0  " onclick="NumPressed(0)">
<input name="btnDecimal" type="Button" value="   .  " onclick="Decimal()">
<input name="btnEquals" type="Button" value="  =  " onclick="Operation('=')">
</FORM>
<SCRIPT LANGUAGE="JavaScript">
var FKeyPad = document.Keypad;
var Accumulate = 0;
var FlagNewNum = false;
var PendingOp = "";
function NumPressed (Num) {
if (FlagNewNum) {FKeyPad.ReadOut.value  = Num;FlagNewNum = false;}
else {
if (FKeyPad.ReadOut.value == "0")
FKeyPad.ReadOut.value = Num;
else
FKeyPad.ReadOut.value += Num;
   }
 }
function Operation (Op)
 {
var Readout = FKeyPad.ReadOut.value;
if (FlagNewNum && PendingOp != "=");
else
{
FlagNewNum = true;
if ( '+' == PendingOp )
Accumulate += parseFloat(Readout);
else if ( '-' == PendingOp )
Accumulate -= parseFloat(Readout);
else if ( '/' == PendingOp )
Accumulate /= parseFloat(Readout);
else if ( '*' == PendingOp )
Accumulate *= parseFloat(Readout);
else
Accumulate = parseFloat(Readout);
FKeyPad.ReadOut.value = Accumulate;
PendingOp = Op;
   }
 }
function Decimal () {
var curReadOut = FKeyPad.ReadOut.value;
    if (FlagNewNum) {curReadOut = "0.";FlagNewNum = false;}
else
    {if (curReadOut.indexOf(".") == -1)curReadOut += ".";}
FKeyPad.ReadOut.value = curReadOut;
  }
function ClearEntry () {FKeyPad.ReadOut.value = "0";FlagNewNum = true;}
function Clear () {Accumulate = 0;PendingOp = "";ClearEntry();}
function Neg () {FKeyPad.ReadOut.value = parseFloat(FKeyPad.ReadOut.value) * -1;}
function Percent () {
FKeyPad.ReadOut.value = (parseFloat(FKeyPad.ReadOut.value) / 100) * parseFloat(Accumulate);
}

SuggestionRe: help w/js Pin
Kornfeld Eliyahu Peter28-Sep-14 1:40
professionalKornfeld Eliyahu Peter28-Sep-14 1:40 
AnswerRe: help w/js Pin
Charlie Kirk6-Oct-14 15:01
Charlie Kirk6-Oct-14 15:01 
Questionmysqli truncate Pin
Charlie Kirk26-Sep-14 15:02
Charlie Kirk26-Sep-14 15:02 
AnswerRe: mysqli truncate Pin
Kornfeld Eliyahu Peter28-Sep-14 1:39
professionalKornfeld Eliyahu Peter28-Sep-14 1:39 
Questioncontinuously scroll multiple pictures on a web page using c# and html Pin
Mike Margolius24-Sep-14 8:20
professionalMike Margolius24-Sep-14 8:20 
AnswerRe: continuously scroll multiple pictures on a web page using c# and html Pin
Ali Al Omairi(Abu AlHassan)24-Sep-14 8:57
professionalAli Al Omairi(Abu AlHassan)24-Sep-14 8:57 
GeneralRe: continuously scroll multiple pictures on a web page using c# and html Pin
Mike Margolius24-Sep-14 9:33
professionalMike Margolius24-Sep-14 9:33 
GeneralRe: continuously scroll multiple pictures on a web page using c# and html Pin
Ali Al Omairi(Abu AlHassan)28-Sep-14 0:49
professionalAli Al Omairi(Abu AlHassan)28-Sep-14 0:49 
AnswerRe: continuously scroll multiple pictures on a web page using c# and html Pin
Richard Deeming24-Sep-14 12:19
mveRichard Deeming24-Sep-14 12:19 
Questionopacity inheritance Pin
Ali Al Omairi(Abu AlHassan)24-Sep-14 1:20
professionalAli Al Omairi(Abu AlHassan)24-Sep-14 1:20 
Questionreload data into gridview control based upon user selection criteria Pin
dcof21-Sep-14 14:42
dcof21-Sep-14 14:42 
QuestionHow to add/update/delete content txt file? Pin
Member 1039071520-Sep-14 4:38
Member 1039071520-Sep-14 4:38 
AnswerRe: How to add/update/delete content txt file? Pin
Richard MacCutchan20-Sep-14 21:09
mveRichard MacCutchan20-Sep-14 21:09 
SuggestionRe: How to add/update/delete content txt file? Pin
Kornfeld Eliyahu Peter20-Sep-14 22:14
professionalKornfeld Eliyahu Peter20-Sep-14 22:14 
Questionhow c++ client calls the js function which is in the firefox extension Pin
l3563319-Sep-14 0:51
l3563319-Sep-14 0:51 
QuestionAny latest UI framework Pin
npatel1234518-Sep-14 7:05
npatel1234518-Sep-14 7:05 
AnswerRe: Any latest UI framework Pin
pitechindore18-Dec-14 0:05
pitechindore18-Dec-14 0:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.