在表格的一列上加上省略号 [英] Add ellipsis on one column of table

查看:80
本文介绍了在表格的一列上加上省略号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



如何在表格的一栏中添加省略号我将分享我的代码,请帮助.


Hi

how to add ellipsis in one column of a table i will share my code please help .


var td1 = document.createElement('td');
        td1.setAttribute('width', '3%');
        td1.setAttribute("align","center");
        td1.innerHTML = r[i].platformNo;;

        var td2 = document.createElement('td');
        td2.setAttribute('width', '42%');
        td2.setAttribute("align","center");
        td2.innerHTML = r[i].originSchDepart + " - " + r[i].fromSchDepart;
*******************Here i want to add ellipsis   so that if station name is more than 10 character it show dot********
        var td3 = document.createElement('td');
        td3.setAttribute('width', '45%');
        td3.setAttribute("align","center");
        td3.innerHTML =  r[i].stationName + " (" + r[i].crsCode + ")";;

        var td4 = document.createElement('td');
        td4.setAttribute('width', '5%');
        td4.setAttribute("align","center");

        var td5 = document.createElement('td');
        td5.setAttribute('width', '5%');
        td5.setAttribute("align","center");
            if(r[i].expArrival ==  r[i].schArrival)
    {
        td4.innerHTML = "<img src=\"images/correct-icon.png\" width=\"24\" height=\"24\" />";
        td5.innerHTML="";
    }
    else
    {
        td4.innerHTML = "<img src=\"images/error.png\" width=\"24\" height=\"24\" />";
        td5.innerHTML=r[i].expArrival;
    }

        tr.appendChild(td1);
        tr.appendChild(td2);
        tr.appendChild(td3);
        tr.appendChild(td4);
        tr.appendChild(td5);
        tbl.appendChild(tr);

推荐答案

您必须使用"jsDraw2D"库才能实现此目的.
这是一个纯JavaScript库,可在不使用SVG,VML或Canvas的情况下在Web浏览器内的网页上绘制2D图形.

以下链接有详细说明:
http://jsdraw2d.jsfiction.com [ ^ ]

画圆:
http://stackoverflow.com/questions/9212902/how-to-generate-circle- using-javascript [^ ]
You have to use "jsDraw2D" library to achieve this.
This is a pure JavaScript library to draw 2D graphics on web pages inside web browser without using SVG,VML or Canvas.

The below link has a detailed description:
http://jsdraw2d.jsfiction.com[^]

To draw a circle:
http://stackoverflow.com/questions/9212902/how-to-generate-circle-using-javascript[^]


这篇关于在表格的一列上加上省略号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆