87,907
社区成员
发帖
与我相关
我的任务
分享
$('#t1 th span').each(function(i,v){
v.innerHTML='日一二三四五六'.charAt(i)
});
$('#t1 th span').each(function(i,v){
v.innerHTML='日,一,二,三,四,五,六'.charAt(i)
});
$(document).ready(function() {
$("th span").each(function(index, dom) {
$(this).text($(this).parent().attr('title').substring(2, 3));
});
});
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/JavaScript">
$(function(){
$("#abv").click(function(){
var ar=new Array();
ar=["日","一","二","三","四","五","六"];
for(var i=0;i<ar.length;i++){
$("th").eq(i).empty().append(ar[i]);
}
});
})
</script>
<input type="button" id="abv" value="测试用按钮"/>
<table border="1" cellpadding="15" >
<tr>
<th title="星期日" role="columnheader"><span>星</span></th>
<th title="星期一" role="columnheader"><span>星</span></th>
<th title="星期二" role="columnheader"><span>星</span></th>
<th title="星期三" role="columnheader"><span>星</span></th>
<th title="星期四" role="columnheader"><span>星</span></th>
<th title="星期五" role="columnheader"><span>星</span></th>
<th title="星期六" role="columnheader"><span>星</span></th>
</tr>
</table>
$('#t1 th span').each(function(i,v){
v.innerHTML=v.parentNode.title.slice(-1)
});
$(function() {
$('th').find('span').each(function(index, dom) {
$(this).html($(this).parent().attr('title').substring(2, 3));
});
});