AspNet技术

.Net平台 + C#语言 + Microsoft SQL Server 开发互联网之web应用!

[原]添加属性

window.onload = function () {
            var tds = document.getElementById('tb').getElementsByTagName('td');
            for (var i = 0; i < tds.length; i++) {
                tds[i].onclick = function () {
                    alert(this.score);
                };
            };
        };
<table id="tb" border="1" cellpadding="0" cellspacing="0">
        <tr>
            <td score="10">#
            </td>
            <td score="20">#
            </td>
            <td score="30">#
            </td>
            <td score="40">#
            </td>
            <td score="50">#
            </td>
        </tr>
</table>

posted on 2014-04-26 22:15  Seves2015  阅读(100)  评论(0编辑  收藏  举报

导航