Nuffnang Ads

Thursday, 4 September 2014

Simple calculator using Javascript - part 1

This time another tutorial to make a simple calculator that will receive two input and will add both inputs.Basically it will look like this:-

1) Open an editor (notepad, notepad++, etc)
2) Put the following codes at the editor:-

<h3> Simple Calculator </h3>
<script language="JavaScript">

function addNum()
<form name="frmadd">

Num1<input type ="text" name="txt1" ><br>
Num2<input type ="text" name="txt2" ><br>
Result<input type ="text" name="txt3" disabled><br>

<input type="button" value="Add" name"but1" onClick="addNum()">


3) Save and Run.

4) You can challenge yourself by creating another mathematical operation like subtraction, multiplication, division

No comments:

Post a Comment