Este artículo describe el método de simplemente ajustar el tamaño de fuente de las páginas web por JS. Compártelo para su referencia, como sigue:
// var tgs = new Array ('div', 'td', 'tr'); var tgs = new array ('td', 'tr'); // especificar espectro de diferentes tamaños de fuentes: // var szs = new array ('xx-small', 'x-small', 'pequeño', 'mediano', 'grande', 'x-large', 'x-large', '', ',' ',', ',', ',', ',', ',', 'x-large', ',' x-large ',', ',', 'x-large'. ); var szs = new array ('10px', '12px', '14px', '16px', '18px', '20px', '22px'); var inicioz = 2; function tsize (trgt, inc) {if (! document.getElementByid) {return} var d = document, cel = null, sz = startz, i, j, ctAgAg; // 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]; para (i = 0; i <tgs.length; i ++) {ctags = cel.getElementsByTagName (tgs [i]); para (j = 0; j <ctags.length; j ++) {ctags [j] .style.fontsize = szs [sz]; }}}Cómo usar:
<td> <a href = "javascript: tsize ('body', 0)"> <img src = "../ image/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 y técnicas de recorrido ", y" Resumen del uso de operaciones matemáticas de JavaScript "
Espero que este artículo sea útil para la programación de JavaScript de todos.