I. Javascript
<script type='text/javascript'>
//<![CDATA[
var tgs = new Array( 'div','td','tr');
var szs = new Array( 'xx-small','x-small','small','medium','large','x-large','xx-large' );
var startSz = 2;
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 ];
}
}
//]]>
</script>
II. Phần HTML
<a href="javascript:ts('body',1)" title="Tăng cỡ chữ"><img src="http://1.bp.blogspot.com/-IX2Mwb_CtmY/T_EMRErYmRI/AAAAAAAAIqI/juFXvkfvhNI/s1600/font-add-2-code1k.com.png" alt="+A" /> Tăng cỡ chữ</a> <a href="#" onclick="location.reload(true);" title="Cỡ chữ mặc định"><img src="http://1.bp.blogspot.com/-qeUtfke_r_Q/T_EMQZ-BhlI/AAAAAAAAIqE/m2EomkrMmsM/s1600/font-2-code1k.com.png" alt="=A" /> Mặc định</a> <a
href="javascript:ts('body',-1)" title="Giảm cỡ chữ"><img src="http://4.bp.blogspot.com/-UXwx-qTZJ4E/T_EMR-XQafI/AAAAAAAAIqQ/feYUYwfIEQs/s1600/font-delete-2-code1k.com.png" alt="-A" />Giảm cỡ chữ</a>