...

View Full Version : Changing the font size



ninthofjune
02-16-2007, 09:57 AM
I'm currently looking at adding javascript to change the font size on a web page by clicking different links. I have found a script here (http://www.white-hat-web-design.co.uk/articles/js-fontsize.php) which does the trick, however I was wondering how I would go about adding some more code so that I could have a link to put the text back to the default size?

ninthofjune
02-16-2007, 11:54 AM
Not to worry, I found another way of adjusting the text, using this code:


function txtSm() {
document.body.style.fontSize='70%';
}

function txtMed() {
document.body.style.fontSize='85%';
}

function txtLg() {
document.body.style.fontSize='100%';
}

and then applying an onclick event handler to an image/text.

Kor
02-16-2007, 04:01 PM
however I was wondering how I would go about adding some more code so that I could have a link to put the text back to the default size?
Use classes rather than style, so you will have a "default" value in a "default" class.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum