Skip to main content

cs101 Assignment 2016 solution


For More Help Ya guides  Visit our Fb Page

https://www.facebook.com/vukhi01/



<html>
<head>
<title></title>
<script>
var firstvalue,secondvalue,operator,sum,total;

function FirstValue()
{
if(document.getElementById("inputbox").value=="")
{
window.alert("Enter A correct number!");
}
else

firstvalue=parseInt(document.getElementById("inputbox").value);
operator=document.getElementById("plus").value;
sum=firstvalue + operator;
document.getElementById("info").innerHTML=sum;
document.getElementById("inputbox").value="";
document.getElementById("plus").disabled = true;
document.getElementById("equal").disabled = false;
document.getElementById("inputbox").autofocus = true;
}
}
function SecondValue()
{
if(document.getElementById("inputbox").value=="")
{
window.alert("Enter A correct number!");
}
else
{
secondvalue=parseInt(document.getElementById("inputbox").value);
total=firstvalue + secondvalue;
total=total+"";
document.getElementById("info").innerHTML="";
document.getElementById("inputbox").value=total;
document.getElementById("plus").disabled = false;
document.getElementById("equal").disabled = true;
}
}
function clean()
{
if(document.getElementById("inputbox").value=!"")
{
document.getElementById("inputbox").value=0;
document.getElementById("info").innerHTML="";
document.getElementById("plus").disabled = false;
document.getElementById("equal").disabled = false;
firstvalue=0;
secondvalue=0;
total=0;
}
}
</script>
</head>
<body>
<h1>Addition Calculator</h1>
<div id="info">
</div>
<table name="mytable" border="2" width="20%" height="100">
<tr><td><input type="text" id="inputbox" name="calculationbar" value="0" size="30" autofocus></td></tr>
<tr>
<td><input type="submit" id="plus" name="plusbutton" value="+" onclick="FirstValue()">
<input type="submit" id="clear" name="clearbutton" value="C" onclick="clean()"></td>
</tr>
<tr>
<td><input type="submit" id="equal" name="equalbutton" value="=" onclick="SecondValue()"></td>
</tr>
</table>
</body>
</html>

Comments

Popular posts from this blog

CS401 Assignment#1 Solution Spring 2018

Assignment No. 1 Graded Semester Spring 2018 Computer Architecture and Assembly Language Programming– CS401 Total Marks: 15 Due Date: 10/05/2018 Question: 1                                                                                                                                        [15...

MGT 602 Quiz #1 Solve

GT-602 Solved Quiz # 1 Question # 1 of 15 ( Start time: 11:15:51 AM )   Total Marks: 1   Government can help in forming new venture by providing:   Select correct option:     Finance   Technology   Infrastructure   Subsidiaries Question # 2 of 15 ( Start time: 11:16:50 AM )   Total Marks: 1   The entrepreneur was distinguished from capital provider in:   Select correct option:     18th century   17th century   19th and 20th century   Middle ages