Valid CSS!

Valid XHTML 1.0 Transitional

Change Fontsize

Changing the fontsize

This script changes the font size for the body of this page. It's my first of this collection of javascripts that I'm writing for the sake of learning javascript.

For those who appreciate the ability to adjust the font size in a website without zooming the entire page, this script will be welcomed. Firefox 3 and IE 7 both have the ability to "CTRL +" to zoom in on the page. However, images also zoom whereas this javascript only makes the fontsize larger. The script runs only once. I don't know why but hope to find out soon.

Click on one of the font sizes to the right to evoke the function. The first one is the browser default so there should be no change unless making the font smaller.

HTML:

<a href="#here" onclick="medium()">A</a>

Javascript:

<script type="text/javascript">
function medium() {
document.body.style.fontSize="medium";
}

function large() {
document.body.style.fontSize="large";
}

function largest() {
document.body.style.fontSize="x-large";
}
</script>