How to change font size using Javascript
var min=11;
var max=16;
function increaseFontSize() {
var p = document.getElementById('storyDiv');
if(p.style.fontSize) {
var s = parseInt(p.style.fontSize.replace("px",""));
} else {
var s = 12;
}
if(s!=max) {
s += 1;
}
p.style.fontSize = s+"px";
}
function decreaseFontSize() {
var p = document.getElementById('storyDiv');
if(p.style.fontSize) {
var s = parseInt(p.style.fontSize.replace("px",""));
} else {
var s = 12;
}
if(s!=min) {
s -= 1;
}
p.style.fontSize = s+"px";
}
Read more...