I use this:
function setFontSize() {
var p = document.getElementsByTagName('td');
for(i=0;i<p.length;i++) {
p[i].style.fontSize = selectedsize+"px"
}
}
What's the simplest and best way to throw in 'th' too?
If you don't have to support older browsers you can use document.querySelectorAll(..)
.
function setFontSize() {
var i;
var p = document.querySelectorAll('td, tr');
for( i = 0; i < p.length; i++ ) {
p[i].style.fontSize = selectedsize + "px"
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With