Este artigo descreve o método de simplesmente ajustar o tamanho da fonte das páginas da web por JS. Compartilhe -o para sua referência, como segue:
//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','x-large','xx-large' ); var szs = new Array ('10px', '12px', '14px', '16px', '18px', '20px', '22px'); var startz = 2; function tsize (trgt, inc) {if (! // sz += inc; sz = inc; if (sz <0) {sz = 0; } if (sz> 6) {sz = 6; } startz = 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]; }}}Como usar:
<td> <a href = "javascript: tsize ('body', 0)"> <img src = "../ imagem/fsize1of.gif" name = "fsize1" id = "fsize1" onmouseover = "mm_swapImage ('fsize1', '', '../image/fsize1on.gif', 1)" onmouseout = "mm_swapimgrestore ()"> </a> </td>For more information about JavaScript related content, please check out the topics of this site: "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 techniques", "Summary of JavaScript data structures and algorithm skills", "Summary of Javascript Algoritmos e Técnicas de Traversal "e" Resumo do Uso do Javascript Mathematic Operations "
Espero que este artigo seja útil para a programação JavaScript de todos.