This article describes the method of simply adjusting the font size of web pages by JS. Share it for your reference, as follows:
//var tgs = new Array('div','td','tr'); var tgs = new Array('td','tr'); //Specify spectrum of different font sizes: //var szs = new Array( 'xx-small','x-small','small','medium','large','x-large','xx-large' ); var szs = new Array( '10px','12px','14px','16px','18px','20px','22px' ); var startSz = 2; function tsize( trgt,inc ) { if (!) { return } var d = document,cEl = null,sz = startSz,i,j,cTags; //sz += inc; sz = inc; if ( sz < 0 ) { sz = 0; } if ( sz > 6 ) { sz = 6; } startSz = sz; if ( !( cEl = ( trgt ) ) ) cEl = ( trgt )[ 0 ]; = szs[ sz ]; for ( i = 0 ; i < ; i++ ) { cTags = ( tgs[ i ] ); for ( j = 0 ; j < ; j++ ) { cTags[ j ]. = szs[ sz ]; } } }
How to use:
<td width="13"> <a href="javascript:tsize('body',0)"> <img src="../image/" name="fsize1" width="18" height="14" border="0" onMouseOver="MM_swapImage('fsize1','','../image/',1)" onMouseOut="MM_swapImgRestore()"></a> </td>
For more information about JavaScript, readers who are interested in reading this site's special topic:Summary of JavaScript switching effects and techniques》、《Summary of JavaScript search algorithm skills》、《Summary of JavaScript animation effects and techniques》、《Summary of JavaScript Errors and Debugging Skills》、《Summary of JavaScript data structure and algorithm techniques》、《Summary of JavaScript traversal algorithm and skills"and"Summary of JavaScript mathematical operations usage》
I hope this article will be helpful to everyone's JavaScript programming.