»
EnglishFrenchVietnamese

Print - Document Text Sizer - JavaScriptBank.com

Full version: jsB@nk » Utility » Document Text Sizer
URL: http://www.javascriptbank.com/document-text-sizer.html

Document Text Sizer © JavaScriptBank.comSometimes the text size you've specified for your webpage isn't suitable to the viewer, depending on his browser configuration or OS. This useful script by Taewook uses Dynamic CSS to let the viewer himself modify the text size of the page on demand, by clicking on an Increase or Decrease Font Size link. Now that's a kind of personalization your viewers may just appreciate.This script is most appropriate for webpages styled using CSS or a minimal of deprecated HTML tags, though it can also affect text sized using explicit <font size="x"> tags (see Customization below). Compatibility wise, a DOM enabled browser is required for the script to take affect- IE5+/NS6+/Opera 7+ etc.

Full version: jsB@nk » Utility » Document Text Sizer
URL: http://www.javascriptbank.com/document-text-sizer.html



JavaScript
<script type="text/javascript">/************************************************ Document Text Sizer- Copyright 2003 - Taewook Kang.  All rights reserved.* Coded by: Taewook Kang (http://www.txkang.com)* This notice must stay intact for use* Visit http://www.dynamicdrive.com/ for full source code***********************************************///Specify affected tags. Add or remove from list:var tgs = new Array( 'div','td','tr');//Specify spectrum of different font sizes: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) returnvar 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><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
JavaScriptBank.com - Bank of over 2000+ free JavaScripts<br><br>JavaScriptBank.com - Bank of over 2000+ free JavaScripts<br><br>JavaScriptBank.com - Bank of over 2000+ free JavaScripts<br><br>JavaScriptBank.com - Bank of over 2000+ free JavaScripts<br><br>JavaScriptBank.com - Bank of over 2000+ free JavaScripts<br><br>JavaScriptBank.com - Bank of over 2000+ free JavaScripts<br><br>JavaScriptBank.com - Bank of over 2000+ free JavaScripts<br><br><a href="javascript:ts('body',1)">+ Zoom in</a> | <ahref="javascript:ts('body',-1)">- Zoom out</a><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->