js实现异色显示

2017-06-26  本文已影响9人  keaidelele
<script type="text/javascript">
            document.write("<tr><td>");
            var seq = '{{$ProDes[0]}}';
            var pss_pre = '{{$pss_pre}}';
            var i;
            for (i =1;i<seq.length;i++){
                document.write(seq[i-1]);
                if(i%60==0){
                    document.write('</td><td>'+i.toString()+'</td></tr><tr><td>');
                    var k = 60;
                    while(k--) {
                        if(pss_pre[i-k]=="C"){
                            document.write('<span style="padding:0;color: #cb2027">'+pss_pre[i - k]+'</span>');
                        }
                        else if (pss_pre[i-k]=="E"){
                            document.write('<span style="padding:0;color: #00a7d0">'+pss_pre[i - k]+'</span>');
                        }else{
                            document.write('<span style="padding:0;color: #00a65a">'+pss_pre[i - k]+'</span>');
                        }
                       if((i-k)%10==0){
                            document.write('  ');
                        }
                    }
                    document.write('</td><td></td></tr><tr><td>');
                }
                else if (i%10==0){
                    document.write('  ');
                }
            }
            document.write('</td><td>'+seq.length.toString()+'</td></tr><tr><td>');
            var k = ;
            while(k--) {
                if(pss_pre[i-k]=="C"){
                    document.write('<span style="padding:0;color: #cb2027">'+pss_pre[i - k]+'</span>');
                }
                else if (pss_pre[i-k]=="E"){
                    document.write('<span style="padding:0;color: #00a7d0">'+pss_pre[i - k]+'</span>');
                }else{
                    document.write('<span style="padding:0;color: #00a65a">'+pss_pre[i - k]+'</span>');
                }
                if((i-k)%10==0){
                    document.write('  ');
                }
            }
            document.write('</td><td></td></tr>');
        </script>
QQ图片20170626145200.png
上一篇下一篇

猜你喜欢

热点阅读