美文网首页
js实现异色显示

js实现异色显示

作者: keaidelele | 来源:发表于2017-06-26 22:52 被阅读9次
    <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

    相关文章

      网友评论

          本文标题:js实现异色显示

          本文链接:https://www.haomeiwen.com/subject/swcscxtx.html