<Script> Var tgs = new Array ('div ', 'td', 'tr '); 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) return Var 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> <Style> . Tabfont {font-size: 12px} </Style> <Body> <A href = "javascript: ts ('body', 1)"> + zoom in font </a> | < Href = "javascript: ts ('body',-1)"> + reduce font </a> <br> <B> Javascript: </B> <br> <Table align = center> <tr> <td class = tabfont> Var tgs = new Array ('div ', 'td', 'tr '); <br> Var szs = new Array ('xx-small', 'x-small', 'small', 'medium ', 'large', 'x-large ', 'xx-large'); <br> Var startSz = 2; <br> Function ts (trgt, inc) {<br> If (! Document. getElementById) return <br> Var d = document, cEl = null, sz = startSz, I, j, cTags; <br> Sz + = inc; <br> If (sz <0) sz = 0; <br> If (sz> 6) sz = 6; <br> StartSz = sz; <br> If (! (CEl = d. getElementById (trgt) cEl = d. getElementsByTagName (trgt) [0]; <br> CEl. style. fontSize = szs [sz]; <br> For (I = 0; I <tgs. length; I ++) {<br> CTags = cEl. getElementsByTagName (tgs [I]); <br> For (j = 0; j <cTags. length; j ++) cTags [j]. style. fontSize = szs [sz]; <br> } <Br> } <Br> </Td> </tr> </Table> <P> <a href = "http://www.bkjia.com/edu" target = "_ blank"> help house tutorial </a> </p> </Body> |