switch case
<% switch (saleslist.status) {
case 0: %>
<span class="label label-warning">已过期</span>
<% break; %>
<% case 1: %>
<span class="label label-success">已发货</span>
<% break; %>
<% case 2: %>
<span class="label label-primary">待处理</span>
<% break; %>
<% case 3: %>
<span class="label label-danger">已取消</span>
<% break; %>
<% } %>
三目运算
<button class="btn col-w1 <%= roleType == -1 ? 'btn-warning' : 'btn-white' %> m-r-xs" type="submit" onclick="$('#roleType').val(-1)" >全部成员</button>
<button class="btn col-w1 <%= roleType == 0 ? 'btn-warning' : 'btn-white' %> m-r-xs" type="submit" onclick="$('#roleType').val(0)" >销售员</button>
<button class="btn col-w1 <%= roleType == 1 ? 'btn-warning' : 'btn-white' %> m-r-xs" type="submit" onclick="$('#roleType').val(1)" >管理员</button>
if else
<% if(member.status == 1) { %>
<input type="hidden" name="status" value=0 >
<button class="btn btn-danger btn-sm demo4" type="submit">停用</button>
<% }else { %>
<input type="hidden" name="status" value=1 >
<button class="btn btn-primary btn-sm demo1" type="submit">启用</button>
<% } %>
for循环
<% for(var i=0; i<rows.length; i++) { %>
<% var commodity = rows[i]; %>
<tr>
<td>
<%= commodity.name %>
</td>
<td>
¥<%= commodity.price %>
</td>
</tr>
<% } %>