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:

<script>
dom = (document.all || document.getElementById)?1:0;
function changeCss(obj,px) {
   if (dom) {
      if (document.all) doc = document.all;
      else doc = document.getElementById;
      doc(obj).style.fontSize=px+'px'
   }
   return false;
}
</script>

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?
rrendermanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

zkeownCommented:
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 CarolinaGrowl.com... look at the source of this page.  Notice the font sizing only affects a specific portion of the page as well.

http://www.carolinagrowl.com/Read.aspx?Story=488

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
R7AFCommented:
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.
0
zkeownCommented:
The font sizer is just below the headline and byline of the story...

Delicious | Print | Email | Font Size
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

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

Computer101
EE Admin
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.