Have you had a look at the
JQuery Library. It is very easy to traverse the dom using jquery and changing the layout of your page.
Another method of possibly changing your Font Size is to apply a new class using Javascript.
For example. You have a set font for the page and two additional css classes with larger or smaller font sizes.
[HTML]<style type='text/css'>
/* DIV Container */
#container .classNormal{
font-size: medium;
}
.classSmaller {
font-size: small;
}
.classLarger {
font-size: large;
}
</style>[/HTML]
- <script type='text/javascript' language='javascript'>
-
function nFont(id, fontClass) {
-
document.getElementById(id).setAttribute('className', fontClass);
-
/*or
-
document.getElementById(id).className = fontClass;
-
*/
-
-
return false;
-
}
-
-
</script>
[HTML]
Font: <a href='#' onclick='javascript
: nFont('container', 'classSmaller');'>[-]</a> <a href='#' onclick='javascript
: nFont('container', 'classLarge');'>[+]</a> <a href='#' onclick='javascript
: nFont('container', 'classNormal');'>[reset]</a>
<div id='container' class='classNormal'>
Here is my font
</div>
[/HTML]
I hope that explains some of it... I would be more than happy to help some more... good learning experience for me too... i'm very fresh to javascript myself...