首页 > 代码库 > 菜品原价为0,说明菜品没有原价.菜品原价大于0,则显示菜品原价.并以删除线删去.每个菜品都是直接取的数据库字段.

菜品原价为0,说明菜品没有原价.菜品原价大于0,则显示菜品原价.并以删除线删去.每个菜品都是直接取的数据库字段.

菜品原价为0,说明菜品没有原价.菜品原价大于0,则显示菜品原价.并以删除线删去.每个菜品都是直接取的数据库字段.

 1 <script type="text/javascript">
 2         function deletelinedisplay() {
 3             var str_s = document.getElementById("DataList1").getElementsByTagName("s").length;
 4             for (var i = 0; i < str_s; i++) {
 5                 var indexContent = document.getElementById("DataList1").getElementsByTagName("s").item(i).innerHTML;
 6 
 7                 if (indexContent.indexOf("0") == 1) {
 8                     document.getElementById("DataList1").getElementsByTagName("s").item(i).innerHTML = "";
 9                 }
10             }
11         }
12       
13     </script>
View Code
 1 <asp:DataList ID="DataList1" runat="server" Height="354px" RepeatColumns="1" HorizontalAlign="Justify"
 2                     RepeatDirection="Horizontal" Width="1355px">
 3                     <ItemTemplate>
 4                         <div class="item">
 5                             <div class="img">
 6                                 <img src="http://www.mamicode.com/UpLoadCaiPinImages/<%# Eval("MenuID")%>.jpg" onclick="ShowDiv(‘MyDiv‘,‘fade‘)"
 7                                     alt="千岛百叶" />
 8                             </div>
 9                             <div class="inkcom">
10                                 <div class="name" onclick="ShowDiv(‘MyDiv‘,‘fade‘)"><%# Eval("MenuName")%></div>
11                                 <div class="price">¥<%# Eval("MenuPrice")%>/<%# Eval("MenuUnit")%></div>
12                                 <s id=<%#Eval("ClassID") %>>¥<%# Eval("OriPrice")%></s>
13                             </div>
14                             <div class="inkcom_bt">
15                                 <div class="clearfix goodssbox" id="Div1" style="float: right;">
16                                     <span class="lgadd fr" id="Span1">
17                                         <input id="btnSub<%# Eval("MenuID")%>" type="button" value="http://www.mamicode.com/-" class=‘lgplus‘ />
18                                         <input id="txtCount<%# Eval("MenuID")%>" type="text" value="http://www.mamicode.com/0" name=‘t1‘ size=‘2‘
19                                             class="addtext" maxlength=‘3‘ datatype=‘Number‘ readonly="readonly" msg=‘必须为数字‘ />
20                                         <input id="btnAdd<%# Eval("MenuID")%>" type="button" value="http://www.mamicode.com/+" class=‘lgminus‘ />
21                                         <a id="btnAddstart<%# Eval("MenuID")%>">点选</a> </span>
22                                 </div>
23                             </div>
24                             <div class="clear">
25                             </div>
26                         </div>
27                     </ItemTemplate>
28                 </asp:DataList>
View Code
1  protected void listbind()
2     {
3         string sqlwhere="Select * from wx_bu_Menu where OriPrice>=0";
4         PublicDataListBase.ShowDataList(DataList1,sqlwhere);
5     }
View Code