私はcssファイルにこれを持っています
.datagrid table tbody td { color: #00496B; border-left: 1px solid
#E1EEF4; font-size: 16px ;font-weight: normal; }
javascript を使用してフォントサイズを動的に変更するにはどうすればよいですか? この次のコードはすべての td で機能しましたが、.datagrid の下の特定の td にアクセスするにはどうすればよいですか? どんな助けでも大歓迎です。
css('td', 'font-size', '9px');
function css(selector, property, value) {
for (var i=0; i<document.styleSheets.length;i++) {//Loop through all styles
//Try add rule
try { document.styleSheets[i].insertRule(selector+ ' {'+property+':'+value+'}', document.styleSheets[i].cssRules.length);
} catch(err) {try { document.styleSheets[i].addRule(selector, property+':'+value);} catch(err) {}}//IE
}
}