2015-12-30 18 views
0

我有一個顯示數據庫數據的Web應用程序。它以0或數字顯示結果。顯示的數字應該是粗體或某種顏色。我該如何在Web應用程序中以粗體顯示來自數據庫的結果。如何使用jsp,javascript,css以粗體或顏色顯示錶格數據

<svp:tbody rowCount="0" maxDisplayRows="100"> 
            <logic:iterate id="Typ" name="Typ"> 
             <logic:iterate id="ordType" name="ordTypes"> 
              <TR> 
               <TD style="font-size: 9px"><bean:write name="Type" 
                 property="TCode" /></TD> 
               <TD style="font-size: 9px"><bean:write 
                 name="Type" property="descr" /></TD> 
               <% 
                for (int i = 0; i < 8; i++) { 
                       String idStr = i + "_order"; 
               %> 
               <TD style="font-size: 9px"><INPUT class="inactive" 
                readonly="readonly" 
                id="${Typ.TCode}_${oType.OTypCode}_<%=idStr%>" 
                type="text" size="10" value="0"></TD> 
               <% 
                } 
               %> 
              </TR> 
             </logic:iterate> 
            </logic:iterate> 
           </svp:tbody> 
+2

我大膽

回答

1

你的問題沒有太多的背景的,所以我只能建議是

<td><b>value</b></td> //if you are using tables 

b標籤製作字體加粗

你也可以使用

<td style='font-weight:bold'>value</td> //if you are using tables, css style 

您還可以使用

<td class='bold'>value</td> //if you are using tables, css style 

.bold //css class definition here 
{ 
    font-weight:bold 
} 
+0

感謝您的答覆。但是從數據庫獲取數據。從數據庫返回的數據應該以粗體顯示。 – user2821894

+0

@ user2821894你可以分享你如何生成表格?你只需要確保在創建值爲粗體的表格時。 – gurvinder372

+0

我的意思是我的值爲0和一些數字如123,456。數字應該顯示爲粗體或某種顏色,但不是零的 – user2821894

0

你的代碼真的很混亂,但從我能理解的,我會嘗試和幫助。

可以說你有一個<td>有一定的價值,你想要大膽?一個風格屬性添加到與TD「字體重量:大膽;」,使它從(例如)<td><td style="font-weight:bold;">

如果你想在大膽做只非零號碼,使用condition?<what to return when true>:<what to return when false>

int numberThatYouPut = ...; 
<td> 
    <%=numberThatYouPut!=0?"<b>"+numberThatYouPut+"</b>:numberThatYouPut%> 
</td> 
+0

你讓我對。你能告訴我如何將上述內容應用於我的代碼。以下是我從中得到結果的代碼片段。 」 type =「text 「size =」10「value =」0「> – user2821894

+0

我的意思是我在哪裏應用您在代碼中給出的邏輯。 – user2821894

相關問題