<td width="56" align="center" height="22">
<font <%if(obj2[17]>0){%>color="#000000" <%}else{%>color="#FF0000"<%}%>><%
out.print(format.format(obj2[17]));
%></font>
</td>
在上面的表格里,当obj2[17]中存的数不小于0时,显示成红色,当小于0时显示黑色,怎样判断?麻烦帮我改下,谢谢

解决方案 »

  1.   

    <td width="56" align="center" height="22"> 
    <%
        if(obj2[17]>=0)    out.println("<font color=red");    else out.println("<font color=black"); 
    %>
    <% 
    out.print(format.format(obj2[17])); 
    %> 
    </font>
    </td> 
      

  2.   

    <td width="56" align="center" height="22"> 
    <% 
        if(obj2[17]>=0) 
    %> 
        <font color=“red")>out.println(" ")</font> 
    <% 
        else 
    %> 
      <font color=“black")>out.println(" ")</font> 
    </td> 
      

  3.   

    <%if(obj2[17]>=0){%>
    <td width="56" align="center" height="22" background-color="red">...</td> 
    <%}else{%>
    <td width="56" align="center" height="22" background-color="black">...</td>
    <%}%>
      

  4.   

    在Eclipse里写“obj2[17]>=0”为什么有红线呢?