多學習 對你有好處php
<div class="a3g w90" style="display: none"> <h3></h3> <span class="rules fl-r js-rules"><a>?</a>排行規則</span> <ul class="ul3"> <script id="a3g" type="text/html"> <%for(var i=0;i<message.length;i++){%> <li> <div class="winfo"> <div class="prize <%if(i==0){%>red<%}else if(i==1){%>yellow<%}else{%>green<%}%>"><span><%=i+1%></span></div> <div class="ninfo"> <a href=""class="fl-l"><img src="http://f3.v.veimg.cn/company_picture/<%=message[i].company_logo%>" alt="" width="85%" height="85%"></a> <div class="fl-r"> <h6><a href=""><%=message[i].company_name%></a></h6> <p><span class="icomoon"></span>熱度 <span><%=message[i].micro_station_share_num%></span></p> </div> </div> </div> </li> <%}%> </script> </ul> </div>
$.ajax({ url:'http://special.veryeast.cn/index.php?m=elite_return&c=index&a=boss', type:'get', dataType:'jsonp', success:function(data){ //console.log(data); var html=template("boss",data); $('.boss').html(html); var role=$('.js-boss > li > .wlist > .video > div > img'); var arr=[]; for(var i=0;i<role.length;i++){ arr.push(role.eq(i).data('userid')); } //console.log(arr); for(var i=0;i<role.length;i++){ if(role.eq(i).data('userid')==arr[i]){ if(role.eq(i).data('role')==1){ role.eq(i).attr('src','http://f3.v.veimg.cn/ve/special/201602/elite/melite/images/'+arr[i]+'-1.png'); }else if(role.eq(i).data('role')==2){ role.eq(i).attr('src','http://f3.v.veimg.cn/ve/special/201602/elite/melite/images/'+arr[i]+'-2.png'); }else{ role.eq(i).attr('src','http://f3.v.veimg.cn/ve/special/201602/elite/melite/images/'+arr[i]+'-3.png'); } } } } });