if you want more related search please click here
please help to other
http://scriptquery.blogspot.in/
Adding , subtracting , division , multiplication using jQuery
-------------------------------------------------------------
<script type="text/javascript">
$(document).ready(function () {
function valusefind(args) {
var a = parseInt($("#Name1").val());
var b = parseInt($("#Name2").val());
if ($("#Name1").val() == "" && $("#Name2").val() == "") { alert("Plese enter value1, value2"); return true; }
else if ($("#Name1").val() == "") { alert("Plese enter value1"); return false; }
else if ($("#Name2").val() == "") { alert("Plese enter value2"); return false; }
else {
switch (args) {
case "A":
var sum = a + b;
break;
case "B":
var sum = a - b;
break;
case "C":
var sum = a * b;
break;
case "D":
var sum = a / b;
break;
case "E":
var sum = a % b;
break;
}
$("#Name3").val(sum);
}
}
$("#plus").click(function () {
valusefind("A");
});
$("#minus").click(function () {
valusefind("B");
});
$("#multi").click(function () {
valusefind("C");
});
$("#divi").click(function () {
valusefind("D");
});
$("#perce").click(function () {
valusefind("E");
});
});
</script>
<center>
<table width="300px" border="1" style="border-collapse: collapse; background-color: #E8DCFF">
<tr>
<td>
First value:
<input type="text" id="Name1" name="firstvalue"/>
</td>
<td>
Last value:
<input type="text" id="Name2" name="lastvalue"/>
</td>
<td>
</td>
<td>
Result=
<input type="text" id="Name3" name="Result:" />
</td>
</tr>
<tr style="width: 100%">
<td>
<input class="design1" type="button" id="plus" value="+"/>
<input class="design1" type="button" id="minus" value="-"/>
</td>
<td>
<input class="design1" type="button" id="multi" value="*"/>
<input class="design1" type="button" id="divi" value="/"/>
</td>
<td>
</td>
<td>
<input class="design1" type="button" id="perce" value="%"/>
</td>
</tr>
</table>
</center>
if you want more related search please click here
please help to other
http://scriptquery.blogspot.in/
6:53 AM
Share:
0 comments: