我试图通过将获得的标记除以 *100/totalmarks 来在第三个文本框中显示值;但我无法做到这一点;
$(document).ready(function () {
$("#TextBoxTotalMarks, #TxBx_MarksObtained").keyup(function () {
var a = parseInt($("#TextBoxTotalMarks").val(), 10);
var b = parseInt($("#TxBx_MarksObtained").val(), 10);
var c;
if (a < b) {
c = "sorry not accepted";
}
else {
c = ((b * 100) / a).toFixed(2);
}
$("#TextBoxMarksInPercent").val(c);
});
});
当我在总分文本框中输入 100 分,在获得的分数文本框中输入 300 分时,我没有看到“对不起,不接受”的消息
<tr>
<td class="shade">
<asp:Literal ID="Ltrl_TotalMarks" runat="server" Text="Total Marks"></asp:Literal>
</td>
<td>
<asp:TextBox ID="TextBoxTotalMarks" runat="server" />
</td>
</tr>
<tr>
<td class="shade">
<asp:Literal ID="Ltrl_MarksObtained" runat="server" Text="Marks Obtained"></asp:Literal>
</td>
<td>
<asp:TextBox ID="TxBx_MarksObtained" runat="server"
</td>
</tr>
<tr>
<td class="shade">
<asp:Literal runat="server" ID="Lit_MarksInPercent" Text="Marks In Percent"></asp:Literal>
</td>
<td>
<asp:TextBox runat="server" ID="TextBoxMarksInPercent" />
<span style="color: black;">%</span>
</td>
</tr>