<script type= "Text/javascript" >functionchangefontsize (size) {varTFS = ' 120% '; varIFS = ' 100% '; varTLH = ' 30px '; varIlh = ' 18px '; Switch(size) { Case110: TFS= ' 110% '; IFS= ' 90% '; TLH= ' 28px '; Ilh= ' 16px '; Break; Case120: TFS= ' 120% '; IFS= ' 100% '; TLH= ' 30px '; Ilh= ' 18px '; Break; Case130: TFS= ' 130% '; IFS= ' 110% '; TLH= ' 34px '; Ilh= ' 22px '; Break; Case140: TFS= ' 140% '; IFS= ' 120% '; TLH= ' 38px '; Ilh= ' 26px '; Break; Case150: TFS= ' 150% '; IFS= ' 130% '; TLH= ' 42px '; Ilh= ' 30px '; Break; } varPnodes = document.getElementsByTagName (' P '); for(vari = 0; i < pnodes.length; i++) { if(Pnodes[i].classname = = ' Imgtxt ') {pnodes[i].style.fontsize=IFS; Pnodes[i].style.lineheight=Ilh; } if(Pnodes[i].classname = = ' txt ') {pnodes[i].style.fontsize=TFS; Pnodes[i].style.lineheight=TLH; } } } </script>
Then we use the WebView to invoke this method, the code is as follows
Webview.loadurl ("javascript:changetextsize (size)");
android--use JS to control the size of the font webview displayed