你好,这是我的详细信息视图中,我有一个输入。点击按钮时,我想比较一下,如果带有txbNumber的文本框的值大于我的模型的属性数量 - >但它给了我语法错误。比较文本框的值的值与模型属性MVC
OnlineStore.Commercial.Models.CategoryProductDetailsViewModel
@{
ViewBag.Title = "Details";
}
<script src="/Scripts/dist/libs/jquery.js"
type="text/javascript"></script>
<table>
<tr>
<td>@Model.bigImageTitle</td>
<td>@Model.Title</td>
<td>@Model.ShortDescription</td>
<td>@Model.Description</td>
<td>@Model.Price</td>
</tr>
</table>
<label>Quantity:</label>
<input type="text" id="txbNumber" />
<input type="button" onclick="validate()" />
<script>
function validate()
{
var regex = /[0-9]|\./;
if (regex.test($("#txbNumber").val()))
{
var orderquantity=$("#txbNumber").val();
if ( @int.Parse(orderquantity) > @Model.Quantity)
{
/*here is the exception
}
}
}
</script>
谁回答第一个:-D – Alberto
我先回答(提示:?你可以很容易地通过查看其答案是答案列表中较高,假设都有票相同金额)检查 –
我看到我的回答更高: - 。/ 无论如何,当然这只是一个玩笑这不是谁是第一,但帮助人们:)这就是为什么我+1你;) – Alberto