【发布时间】:2018-05-05 10:58:44
【问题描述】:
首先,我几个小时前已经问过同样的问题,但得到的答案根本没有帮助。从那时起我的问题就消失了(几个小时的观看次数相同)。 我有一个 mongodb 集合,我正在使用 node.js 。我有一个“衣服”的集合,我在这张表中表示它的数据:
<h2>Clothes</h2>
<table class="table">
<thead>
<tr>
<th>price</th>
<th> date </th>
<th>Delete</th>
</tr>
</thead>
<tbody>
<% for(var i = 0; i < result.length; i++){%>
<% if(result[i].type == "price"){%>
<tr>
<td><%= result[i].price %></td>
<td><%= result[i].date %></td>
<td>
<form action="/delete-price" method="POST">
<input type="hidden" name="id" value="<%= result[i]._id %>">
<input type="submit" name="submit" value="Delete">
</form>
</td>
</tr>
<%}%>
<%}%>
</tbody>
</table>
日期可以是一周中的任何一天。我的问题是,我想让用户通过表单提交一定的预算(这很容易),但我想同时比较所有行的所有费用
该表和数据库一样正常工作且功能齐全。
一个例子:
Ex: If the user enters budget of 200$ , I should go to all the rows in
"Clothes" , check the prices, if the prices is greater than the budget, this
row should be flagged .`
我怎样才能做到这一点?我对此很陌生。我尝试在 html 和 css 中执行此操作,但这是我的知识停止的地方
【问题讨论】:
-
您希望切换值成为行的属性,而不仅仅是表单输入。一旦它在行上,您可以循环行,将属性与值进行比较,并将行的 css 设置为指示状态。
-
不建议转发相同的问题。请参阅this Meta answer 了解让您的问题得到更多关注的更好方法(并希望得到一些答案)。
标签: javascript html css node.js mongodb