We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
当数据库里的数据只有一个时,怎样让jquery只显示一条数据,而不是追加 这是:table.html
//response=JSON.parse(response); $('#spa').html(response[7]); if(response[1]==3){ response[5]="蓝色预警"; $('#divb .tab .trr #1').html(response[0]+"楼"); $('#divb .tab .trr #2').html(response[1]+"号"); $('#divb .tab .trr #3').html(response[2]); $('#divb .tab .trr #4').html(response[3]); $('#divb .tab .trr #5').html(response[4]+"K"); $('#divb .tab .trr #6').html(response[5]); $('#divb .tab .trr #7').html(response[6]); html=""; for(var i=0;i<7;i++){ html="<tr class='trr'><td>"+(response[0]+"楼")+"</td><td>"+(response[1]+"号")+"</td><td>"+response[2]+"</td><td>"+response[3]+"</td><td>"+(response[4]+"K")+"</td><td>"+response[5]+"</td><td>"+response[6]+"</td></tr>"; } $('#divb #tab').append(html); }else if(response[1]==4){ response[5]="橙色预警"; $('#divb .tab .trr #1').html(response[0]+"楼"); $('#divb .tab .trr #2').html(response[1]+"号"); $('#divb .tab .trr #3').html(response[2]); $('#divb .tab .trr #4').html(response[3]); $('#divb .tab .trr #5').html(response[4]+"K"); $('#divb .tab .trr #6').html(response[5]); $('#divb .tab .trr #7').html(response[6]); html=""; for(var i=0;i<7;i++){ html="<tr class='trr'><td>"+(response[0]+"楼")+"</td><td>"+(response[1]+"号")+"</td><td>"+response[2]+"</td><td>"+response[3]+"</td><td>"+(response[4]+"K")+"</td><td>"+response[5]+"</td><td>"+response[6]+"</td></tr>"; } $('#divb #tab').append(html); }else{ $('#diva .tab .trr #1').html(response[0]+"楼"); $('#diva .tab .trr #2').html(response[1]+"号"); $('#diva .tab .trr #3').html(response[2]); $('#diva .tab .trr #4').html(response[3]); $('#diva .tab .trr #5').html(response[4]+"K"); $('#diva .tab .trr #6').html(response[5]); $('#diva .tab .trr #7').html(response[6]); html=""; for(var i=0;i<7;i++){ html="<tr class='trr'><td>"+(response[0]+"楼")+"</td><td>"+(response[1]+"号")+"</td><td>"+response[2]+"</td><td>"+response[3]+"</td><td>"+(response[4]+"K")+"</td><td>"+response[5]+"</td><td>"+response[6]+"</td></tr>"; } $('#diva #tab').append(html); } ; /* $('#div1 .tab .trr #1').html(response[0]+"楼"); $('#div1 .tab .trr #2').html(response[1]+"号"); $('#div1 .tab .trr #3').html(response[2]); $('#div1 .tab .trr #4').html(response[3]); $('#div1 .tab .trr #5').html(response[4]+"K"); $('#div1 .tab .trr #6').html(response[5]); $('#div1 .tab .trr #7').html(response[6]); $('#div2 .tab .trr #1').html(response[0]+"楼"); $('#div2 .tab .trr #2').html(response[1]+"号"); $('#div2 .tab .trr #3').html(response[2]); $('#div2 .tab .trr #4').html(response[3]); $('#div2 .tab .trr #5').html(response[4]+"K"); $('#div2 .tab .trr #6').html(response[5]); $('#div2 .tab .trr #7').html(response[6]);*/ //alert($('tr[id=11] td[id=5]').html());//调试 //$('#div1 .tab tr[id=12] td[id=1]').html(response[0]); /* html=""; for(var i=0;i<7;i++){ html="<tr class='trr'><td>"+(response[0]+"楼")+"</td><td>"+(response[1]+"号")+"</td><td>"+response[2]+"</td><td>"+response[3]+"</td><td>"+(response[4]+"K")+"</td><td>"+response[5]+"</td><td>"+response[6]+"</td></tr>"; } $('#div1 #tab').append(html); $('#div2 #tab').append(html); */ // alert($('.tab tr').length); $('#diva .tab tr').each(function(index) { if(index>3000){ $(this).hide; } }); $('#divb .tab tr').each(function(index) { if(index>3000){ $(this).hide; } }); $('#num1').html($('#diva .trr').length-1); $('#num2').html(($('#divb .trr').length-1)); } }) };
$(document).ready(function(){ $("tr:odd").css("background-color","#B2E0FF"); }); 这是:
如果解决了,麻烦通知我一下;qq是:1539286010
The text was updated successfully, but these errors were encountered:
@pingtang121212 我给你一个思路:你首先去获取当前数据库是否是一条,如果是,就显示,不追加。否则。。。。。
Sorry, something went wrong.
No branches or pull requests
当数据库里的数据只有一个时,怎样让jquery只显示一条数据,而不是追加
<title>无标题文档</title> <style> .tab{border:2px solid #09C; border-collapse:collapse;width:100%; } .trr{border:2px solid #09C; border-collapse:collapse; } table .trr th{border:2px solid #09C; font-size:14px; font-family:'黑体';background-color:#CCC; height:14px } table .trr td{border:2px solid #09C; font-size:14px; font-family:'黑体'; height:10px ; text-align:center} </style> <script type="text/javascript" src="http://keleyi.com/keleyi/pmedia/jquery/jquery-1.10.2.min.js"></script> <script type="text/javascript" src="table.js"> </script>这是:table.html
$(document).ready(function(){
$("tr:odd").css("background-color","#B2E0FF");
});
这是:
如果解决了,麻烦通知我一下;qq是:1539286010
The text was updated successfully, but these errors were encountered: