increase or decrease text size - A + A

Hello everyone,

I need a very simpe funtion on a webpage where people can increase or decrease the font size.
No heavy cookies or a giant ocean of java, just as simple as can be.
( - A + A)

I allready have this:

dom = (document.all || document.getElementById)?1:0;
function changeCss(obj,px) {
   if (dom) {
      if (document.all) doc = document.all;
      else doc = document.getElementById;
   return false;

AND two buttons with small A and big A on the top of the page

 <a href="#" onClick="return changeCss('t',11)"><img border="0" src="lettersize_smaller.gif"></a></td>
                                <td width="14" height="33">
                                <a href="#" onClick="return changeCss('t',12)"><img border="0" src="lettersize_bigger.gif"></a></td>
                                <td width="98" height="33">

..... this function only allowe me to change from 11 px up to 12 px... but the page has all kinds of sizes
from big headlines, small imagetext to very small contact infos in the bottom...

... So what I need is to change the function so it increase / decrease the fonts in some kind of harmony like using % percent.

Do you know any way to change the script or a similar script which is very easy to use?
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

zkeownConnect With a Mentor Commented:
Generally you should define your font sizes in "em"s, as it makes font size on the browser and in your code much more easy & predictable.

I used a very similar method on look at the source of this page.  Notice the font sizing only affects a specific portion of the page as well.

I don't see any A+ or A- on your page. Furthermore, if I press ctrl-+ all fonts get bigger, not just a portion of it. Still the concept is interesting.
The font sizer is just below the headline and byline of the story...

Delicious | Print | Email | Font Size
The new generation of project management tools

With’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Sorry, totally missed that! It looks nice!
Thanks!  Let me know if you have any questions on the implementation...  I might even remember how it works :)
Just wondering if you ever had any luck.
Forced accept.

EE Admin
All Courses

From novice to tech pro — start learning today.