コードを修正しました。ただし、値が NaN であることを示すアラートが表示されるようになりました。ただし、数です。parseInt が少し役に立ちました。私はおそらく何かが欠けています。現在、私のコードは次のようになっています。
<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>