页:
[1]
| kind.huang | 2004-12-5 10:07 AM |
|
JavaScript:放大及縮小字體
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=big5">
<script language="JavaScript" type="text/javascript">
var curfontsize=10;
var curlineheight=18;
function fontZoomA(){
if(curfontsize>8){
document.getElementById('fontzoom').style.fontSize=(--curfontsize)+'pt';
document.getElementById('fontzoom').style.lineHeight=(--curlineheight)+'pt';
}
}
function fontZoomB(){
if(curfontsize<64){
document.getElementById('fontzoom').style.fontSize=(++curfontsize)+'pt';
document.getElementById('fontzoom').style.lineHeight=(++curlineheight)+'pt';
}
}
</script>
</head>
<body>
<a href="javascript:fontZoomA();" class="top_UserLogin">放大字體</a>
<br>
<a href="javascript:fontZoomB();" class="top_UserLogin">縮小字體</a>
<p id="fontzoom">此處的字體可以放大縮小</p>
<p>此處的字體不會放大縮小</p>
</body>
</html> |
Powered by Discuz! Archiver 6.1.0
© 2001-2006 Comsenz Inc.
Processed in 0.005751 second(s), 2 queries |