//Specify affected tags. Add or remove from list: var tgs = new Array( 'div','td','tr','p', 'a'); //Specify spectrum of different font sizes: var szs = new Array( 'xx-small','x-small','small','medium','large','x-large','xx-large' ); var startSz = 1; function ts( trgt,inc ) { if (!document.getElementById) return var d = document,cEl = null,sz = startSz,i,j,cTags; sz += inc; if ( sz < 0 ) sz = 0; if ( sz > 6 ) sz = 6; startSz = sz; if ( !( cEl = d.getElementById( trgt ) ) ) cEl = d.getElementsByTagName( trgt )[ 0 ]; cEl.style.fontSize = szs[ sz ]; for ( i = 0 ; i < tgs.length ; i++ ) { cTags = cEl.getElementsByTagName( tgs[ i ] ); for ( j = 0 ; j < cTags.length ; j++ ) cTags[ j ].style.fontSize = szs[ sz ]; } } /** * Step 1: Add the following code to the section of your web page: * * * Step 2: Now set up the two links that will increase and decrease your text size. The following will do nicely: * + Larger Font | * + Smaller Font * * And that's it! * * Customization * There are two areas within the script you can make changes. * * First, within textsizer.js, you can add additional HTML tags the script should affect. Lets say your webpage's * text are all controlled using explicit tags. You can add "font" as a tag the script should affect. * * Second, inside the code of Step 2, you may substitute "body" with another tag name or even ID name, to * localize the text size manipulation to only the specified containers. * **/