Fixed my code up. However, now the alert pops up saying your value is NaN. However, it is a number. The parseInt, helped a little bit. I am most likely missing something. Right now my code looks like this:
<input id="a" type="text">
<script>
function myFunction()
{
x=document.getElementById("a").value;
if(x==""||isNaN(x))
{
alert("Your First Number is Not Numeric");
}
a=document.getElementById("a").value;
}
</script>
<button type="button" onclick="myFunction()">Submit Number</button>
<br />
<p>Second Number</p>
<br />
<input id="b" type="text">
<script>
function myFunction1()
{
x=document.getElementById("b").value;
if(x==""||isNaN(x))
{
alert("Your Second Number is Not Numeric");
}
b=document.getElementById("b").value;
}
</script>
<button type="button" onclick="myFunction1()">Submit Number</button>
<br />
<script>
function add()
{
d=parseInt(a);
e=parseInt("b");
c=d+e;
alert("The number is " + c);
}
</script>
<button type="button" onclick="add()">Add numbers</button>
Input values are strings. Use
parseIntor another means of converting them to a number fore you try to add them.